Add Two Numbers
Here, you will learn and get the source code of a simple c program to add two numbers. In the program, First we will get two numbers from the user as input, calculate the sum, and print sum as result in c programming.
For example
2 + 4 = 6
C Program to Add Two Numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 | //Sum of Two Numbers in C #include<stdio.h> int main() { int n1, n2, sum; printf("\nEnter Two Numbers: "); scanf("%d%d",&n1,&n2); sum = n1 + n2; printf("\nSum = %d",sum); return 0; } |
Output
Enter Two Numbers: 4
5
Sum = 9
Check out our other C programming Examples