C Program For to Add Two Integers

Ram Pothuraju
#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

Post a Comment

0Comments

Post a Comment (0)