In this example, we take two integer input from user and print addition of them.
In this Example, We are going to use scanf() function to taking user input and printf() function to print.
Example :
#include <stdio.h>
int main()
{
int num1, num2, sum;
printf("Enter first number: \n");
scanf("%d", &num1);
printf("Enter second number: \n");
scanf("%d", &num2);
sum = num1 + num2;
printf("Sum of the entered numbers: %d", sum);
return 0;
}
Output :
Enter first number:
10
Enter second number:
20
Sum of the entered numbers: 30
Ask anything about this examples