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: The length & breadth of a rectangle and radius of a circle are input through the keyboard. Write a program to calculate area & perimeter of the rectangle and area & circumference of the circle.

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 ‘%’)