A Program to Add Two Integer Numbers
In this example, we are giving a program to add two integer numbers which are given by the user.
Program to add two integer numbers:
#include <stdio.h>
int main()
{
int first_number, second_number, sum;
printf("Enter two integers: ");
// Two integers entered by user stored
scanf("%d %d", &first_number, &second_number);
// Sum of the two numbers stored in the variable sum
sum = first_number + second_number;
// Displaying the value of sum
printf("%d + %d = %d", first_number, second_number, sum);
return 0;
}
Output:
Enter two integers: 7 17 7 + 17 = 24