Program: 33
Write a C program to perform the operation more than one times.
#include
#include
void main()
{
int a, b, ch, sum;
do
{
printf("Enter first number: ");
scanf("%d", &a);
printf("Enter second number: ");
scanf("%d", &b);
sum=a+b;
printf("\nThe sum of two numbers is %d\n\n", sum);
printf("Press 1 to continue or press any key for exit: ");
scanf("%d", &ch);
}
while(ch==1);
getch();
}
|
Output |
Enter first number: 54 Enter second number: 63
The sum of two numbers is 117
Press 1 to continue or press any key for exit: 1
Enter first number: 56
Enter second number: 34
The sum of two numbers is 90
Press 1 to continue or press any key for exit: 3
|
Leave a Comment