C Program for Addition of Two Numbers

Addition is one of the basic operation in the world of computer programming. In This article we are going to see a c program for addition of two numbers.

c code for addition

C Program for Addition of Two Numbers

#include <stdio.h>

void main(){
    int a, b;
    printf("enter the first numbner");
    scanf("%d", &a);
    printf("enter the 2nd number");
    scanf("%d", &b);
    printf("%d + %d = %d", a, b, a + b);
}

In the C program above, we first declare two variables named a and b. After that, we ask the user to enter two numbers. Finally, we print the sum of the two given numbers.

Output

C Program for Addition of Two Numbers

See Also

3 thoughts on “C Program for Addition of Two Numbers”

Leave a Comment