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 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include <stdio.h> int main() { int num1,num2,result; printf("Enter the Number 1\n"); scanf("%d",&num1); printf("Enter the Number 2\n"); scanf("%d",&num2); result = num1+num2; printf("%d + %d = %d",num1,num2,result); return 0; } |
Output: