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 print "Hello World", 10 times on the screen. We will use "body-less-loop" for this C-Program. "Body-less-loop" : it means that the inner part(code block to be executed) of the loop will be empty and the loop will have a semi-colon(;) in it's end. i.e: for ( ..... ; ..... ; ..... ) ; input: Null. output: "Hello World" will be printed on the screen, 10 times. CODE----> #include<stdio.h> int main() { int i; for( i=1 ; i<=10 ;printf( " Hello World ! \n ", i++ )) ; return 0 ; } 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