Program to Add Two Integers

#include <stdio.h>
int main() {   

    int number1, number2, sum;
   
    printf("Enter two integers: ");
    scanf("%d %d", &number1, &number2);

    /* calculating sum*/
    sum = number1 + number2;     
   
    printf("%d + %d = %d", number1, number2, sum);
    return 0;
}


-----------------------------------------
Output:

Enter two integers: 10
22
10 + 22 =32





Comments

Popular posts from this blog

Q: Two number are input through the keyboard into two two locations C and D. write a program to interchange the contents of C and D.

Q: Consider a currency system in which there are note of seven denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. if a sum of Rs. N is entered through the keyboard, write a program to compute the smallest number of notes that will combine to give Rs N.