Write a C program to input two number and print the sum using third variable.
void main()
{
int first,second,sum; // Variable declaration
printf("Enter Two No.");
printf("%d%d",&first,&second); // number stored in first and second variable
sum=first+second; // add two no
printf("Sum=%d",sum); // print the addition with message
getch(); // waits untill any key is pressed.
}
Input: 5 10
Output: Sum=15
{
int first,second,sum; // Variable declaration
printf("Enter Two No.");
printf("%d%d",&first,&second); // number stored in first and second variable
sum=first+second; // add two no
printf("Sum=%d",sum); // print the addition with message
getch(); // waits untill any key is pressed.
}
Input: 5 10
Output: Sum=15