Sum of Two Numbers in C Language
Sum of Two Numbers in C
Introduction:
Adding two numbers is a fundamental operation in programming. This program demonstrates how to take user input and perform addition.
Program:
Explanation:
- int num1, num2, sum; : declared num1,num2 and sum as integer.
-
scanf("%d %d", &num1, &num2);
: Reads two integers from the user and stores in num1 and num2 integers. -
sum = num1 + num2;
: Calculates the sum of the two numbers. -
printf("Sum: %d", sum);
: Used to displays the result in output screen.
Comments
Post a Comment