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: If a five-digit number is input through the keyboard, write a program to calculate the sum of its digits. (Hint: Use the modulus operator ‘%’)

Q: If value of an angle is input through the keyboard, write a program to print all its Trigonometric ratios.