Problem Statement
In this program we will code a basic program to add two numbers in C programming language.
We can do this with the help of
- Predefined C function – printf()
Code
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter first number : ");
scanf("%d", &a);
printf("Enter second number : ");
scanf("%d", &b);
c = a+b;
printf("Sum is : %d",c);
return 0;
}
Output
Enter first number : 34
Enter second number : 32
Sum is : 66
Explanation
To add two numbers, (after taking both numbers as input) we simple use + (plus) operator.