This is an example program that demonstrates how you can perform the addition of two user given numbers in C language.
In this program first we are taking two integer numbers from the user, and then displaying the result of addition into the console.
Program
#include <stdio.h> int main() { int num1, num2, sum; printf("Enter 1st number : "); scanf("%d", &num1); printf("\nEnter 2nd number : "); scanf("%d", &num2); sum = num1 + num2; printf("\nResult = %d\n", sum); return 0; }
Output
Enter 1st number : 10
Enter 2nd number : 20
Result = 30