Tag: Program

C program to add two integers and find their sum

In this C program we are going to take two integer inputs from the user then add it display its sum on the screen.

#include<stdio.h>
int main(){

    //below line declares two integers to add and one integer to store the sum
    int number1, number2, sum;

    //let the user know to enter two integers
    printf("Enter two integers");

    //now let us take the input from the user 
    scanf("%d %d", &number1, &number2);

    //now add the two integers
    sum = number1 + number2;

    //print the sum below
    printf("Sum of %d + %d is %d\n", number1, number2, sum);
    
    return 0;
}

The above code will take inputs from user and add those numbers and display their sum.

The output will look like below

There is a video tutorial doing the same.