C Example Program to Add Two Numbers Entered By the User
Here we have a C example program to add two numbers entered by the User
In this program first we ask the user to enter two Numbers. Then we use the Addition Operator available in c language to perform the addition.
You can make this program to work for Subtraction, Multiplication and Division just by changing the operator.
Example C Program to Add two Numbers
1 #include <stdio.h>
2
3 int main()
4 {
5 int num1,num2,result;
6 printf("Enter the Number 1\n");
7 scanf("%d",&num1);
8 printf("Enter the Number 2\n");
9 scanf("%d",&num2);
10
11 result = num1+num2;
12
13 printf("%d + %d = %d",num1,num2,result);
14
15 return 0;
16 }