C program for addition of Two Integer values
num1
and num2
are two integer variables and performed sum using +
operator.
#include<stdio.h>
int main()
{
int num1,num2,sum;
printf("Enter two numbers to Perform Addition:");
scanf("%d %d",&num1,&num2);
sum=num1+num2; //integer sum
printf("the sum of %d and %d is %d",num1,num2,sum);
return 0;
}
Output for integer sum:
Enter two numbers to Perform Addition:10 20 the sum of 10 and 20 is 30