Filled Under:
Example of printf and scanf.. (easy)
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
printf("Example of printf and scanf\n");
printf("enter the value of a and b");
scanf("%d%d",&a,&b);
c=a+b;
printf("the sum is:%d",c);
getch();
}
Here printf prints the phrase Example of printf and scanf and enter the value of a and b. "\n" prints the phrase in a newline. Scanf stores the value of "a" and "b" entered by the user. "+" sign does the addition and store the value in c. Again printf prints the value of c.
0 comments:
Post a Comment