Code:
#include <stdio.h>
int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;
printf("Enter first integers: ");
scanf("%d", &firstNumber);
printf("Enter secound integers: ");
scanf("%d", &secondNumber);
// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = firstNumber + secondNumber;
// Displays sum
printf("firstNumber : %d + secondNumber : %d = Sum : %d", firstNumber, secondNumber, sumOfTwoNumbers);
return 0;
}
Output:
Enter first integers: 12
Enter first integers: 10
firstNumber : 12 + secondNumber : 10 = Sum : 22
Or
#include <stdio.h>
int main()
{
int firstNumber, secondNumber, sumOfTwoNumbers;
printf("Enter two integers: ");
// Two integers entered by user is stored using scanf() function
scanf("%d %d", &firstNumber, &secondNumber);
// sum of two numbers in stored in variable sumOfTwoNumbers
sumOfTwoNumbers = firstNumber + secondNumber;
// Displays sum
printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);
return 0;
}
Output
Enter two integers: 12
11
12 + 11 = 23
0 Comments
If you have any doubts, Please let me know