C – Find Sum of Two Numbers

To find the sum of two numbers in C programming, use Arithmetic Addition Operator, and pass the two numbers as operands to this operator.

Refer C Arithmetic Addition Operator tutorial.

C Program

In the following program, we read two numbers from console entered by the user into integer variables, and find their sum using Addition Operator.

main.c

</>
Copy
#include <stdio.h>

int main() {
    int a, b, result;
    
    printf("Enter first  number : ");
    scanf("%d", &a);
    
    printf("Enter second number : ");
    scanf("%d", &b);
    
    //add two numbers
    result = a + b;
    printf("Sum : %d\n", result);
    
    return 0;
}

Output

Enter first  number : 4
Enter second number : 3
Sum : 7
Program ended with exit code: 0

Conclusion

In this C Tutorial, we learned how to write a program to find the sum of two numbers entered by user in the console.