Q. If sum of two integer is 14 and if one of them is 8 then find other integer. Ans: Well, this is very simple. Simply, one integer is 8 and sum of two integers is 14. So, we need to subtract the number 8 from their sum of 14 to get the second number. So, the second number is: 14 - 8 = 6 C-Program of this task Code---> #include<stdio.h> int main () { int num1 = 8 , num2 , sum = 14 ; num2 = sum - num1 ; printf ( "The second number is: %d" , num2 ); return 0 ; }
In this C -program we will scan the numbers using array and then we will calculate the sum of the given numbers, also using array. The numbers will be taken from the user. input: 5 numbers.(i.e : 5,6,9,56,548) output: The sum of the given numbers will be printed on the screen. CODE----> #include<stdio.h> #include<stdlib.h> main() { int arr[5],i,sum=0; printf (" Enter Five numbers : "); for ( i=0 ; i<5 ; i++ ) { scanf (" %d ",&arr[i]); } for ( i=0 ; i<5 ; i++ ) { sum=sum+arr[i]; } printf (" \n The sum of the given 5 numbers is : %d\n ",sum); system (" pause "); } Don't just read, write it, run it..... RESULT :
Write a C program to print all natural numbers from 1 to n using for loop.
ReplyDeleteCode of given problem:
int main()
{
int i=1,n;
printf("Enter the number to print all natural number till that entered number\t");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("%d\t",i);
}
return 0;
}
Very informative blog!
Please take some time to visit my blog @
for loop program examples
Thanks!
Widcanpostga-1996 Dan Portwood https://marketplace.visualstudio.com/items?itemName=subdiber-ki.VIRTUAL-SOLDIERS-gratuita-2021
ReplyDeletevoilimentryt
OeritYerbiHuntsville Kimberly Vaughn https://www.iam-thatgirl.com/profile/Daemon408-139-X64rar-BETTER/profile
ReplyDeletebrimogistor
sisa0so-ku Kimberly Turner click here
ReplyDeletedownload
https://colab.research.google.com/drive/1ecWLNLSzduq_Rm6pRNjL-Gvef6W7Mg4p
download
adgravconse
words from f
ReplyDelete