Sum of two numbers in C Language

Sum of two numbers in C Language

Write a program in C Language to sum of two numbers.

This is very simple program where we learn how to add or sum of two numbers in C Language. In this program values are in variables by default initialize by us.


Program to sum of two numbers

/*    Sum of two Numbers    */
int main()
    int a = 10;
    int b = 20;
    int c;

    c = a + b;
    printf("%d + %d = %d",a, b, c);
    return 0;



10 + 20 = 30

In this program we have defined three variable a, b and c We have initialize in variables a and b respectively 10 and 20.

Then, variables a and b are added using + operator and the result is initialize in c.

Finally, the c is displayed on the screen using printf() function.

Leave a Reply

Close Menu