Program to calculate the sum of the two number in c-programing?
In this program ,we will find how to calculate the sum of the two integers entered by the user and print the sum of the values in c-language.
When user entered the two values, then this two integers are stored in variables a and b respectively. then these two numbers are added using the + operator ,and result is stored in the sum variable.
#include<stdio.h>
#inlcude<conio.h>
main()
{
int a,b,sum=0;
printf("Enter two numbers");
scanf("%d%d",&a,&b);
sum=a+b;
printf("sum of %d and %d is %d",a,b,sum);
getch();
}
output :-
enter the two numbers a=4 and b=6
the sum of the two number are c=10
No comments:
Post a Comment