C Language program to take two numbers from user and add those two numbers

Views: 105   

Following program shows you how to take two numbers from user and add those two numbers.
In this program we take two numbers from user using scanf method and add those two numbers

#include <stdio.h>
int main(void) {
    int input1;
    int input2;

    printf("Enter first number:");
    scanf("%d", &input1);

    printf("Enter second number:");
    scanf("%d", &input2);

    int result = input1 + input2;

    printf("Sum of the given two numbers is: %d ", result);
}

Output:

Enter first number: 10
Enter second number: 30
Sum of the given two numbers is: 40
On By