To take input form the user we use a function called "scanf()" in c. Now lets see how we use "Scanf()" into a c program to take an input from the user.
so lets begin.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,sum=0;
printf("Please enter two integers\n");
scanf("%d%d",&a,&b);
sum=a+b;
printf("sum of numbers is:%d\t",sum);
return 0;
}
No comments:
Post a Comment