C Program to Add Two Integer Numbers

July 27, 2020

C Program and algorithm to find the sum of two integers entered during the execution of the program.

C Program & Algorithm to find the sum of two integers

Aim: Write a C Program to find the sum of two integer numbers.

Algorithm

Step 1: Start

Step 2: Read the first number

Step 3: Read the second number

Step 4: Calculate the Sum of two numbers

Step 5: Print the result

Step 6: Stop

Program


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

    int n1, n2, sum;
    
    //Input the first number
    printf("Enter First Number: ");
    scanf("%d", &n1);
    
    //Input the second number
    printf("\nEnter Second Number: ");
    scanf("%d", &n2);

    // calculate sum of two numbers
    sum = n1 + n2;      
    
    //print the result
    printf("%d + %d = %d", n1, n2, sum);
    return 0;
}

Output

Enter First Number: 12

Enter Second Number: 23
12 + 23 = 35
Tagged in:
About Author
Adeeb C (223 Articles)

Adeeb C is a Web Designer, Web Application Developer, Android App Developer, WordPress Developer, Professional Blogger. He has 5 years of experience in WordPress, Web Developing, Professional Blogging, and 2 years of experience in Android App Developing.