C: Sum of two integer numbers.

Question:

Write a program to find the sum of two integer numbers.

Answer:


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

    int number1, number2, sum;
    
    printf("Enter First integers: ");
    scanf("%d", &number1);
    
    printf("Enter Second integers: ");
    scanf("%d", &number2);

    // calculating sum
    sum = number1 + number2;      
    
    printf("Sum of two numbers: %d + %d = %d \n", number1, number2, sum);
    return 0;
} 
 


Output is:


In below screen shoot, we have shown that how to compile C file(add.c) and run over linux(Ubuntu)
system.
 

No comments:

Post a Comment