C program to Add Two Integer

 Addition Of Two Values In C language





#include <stdio.h>

int main() {
    int num1, num2, sum;

    // Ask user to enter two numbers
    printf("Enter first number: ");
    scanf("%d", &num1);

    printf("Enter second number: ");
    scanf("%d", &num2);

    // Add the two numbers
    sum = num1 + num2;

    // Display the result
    printf("Sum of %d and %d is %d\n", num1, num2, sum);

    return 0;
}



output




Enter first number:
10

Enter second number:
20

Sum of 10 and 20 is 30



Post a Comment

0 Comments