Menu

Add Topic

Forum

waiting answer September 24, 2020

Write a C program to find Sum of Two Numbers

Write a C program to find Sum of Two Numbers

Answers
September 24, 2020

        #include
        int main() {
           int num1, num2, sum;
 
           printf("\nEnter two numbers: ");
           scanf("%d %d", &num1, &num2);
 
           sum = num1 + num2;
 
           printf("Sum of two numbers= %d", sum);
 
           return(0);
        }

Output

Enter two numbers: 10 12

Sum of two numbers= 22

0 0
September 24, 2020

#include 
int main() {    

    int num1, num2, sum;
    
    printf("Enter two integer numbers: ");
    scanf("%d %d", &num1, &num2);

    // calculating sum
    sum = num1 + num2;      
    
    printf("%d + %d = %d", num1, num2, sum);
    return 0;
}

Output

Enter two integer numbers: 3 3

3 + 3 = 6

Enter two integer numbers: 1 3

0 0

Please Login to Post the answer

Leave an Answer