53.2k views
2 votes
Write a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. Then the user should be asked if he or she wishes to perform the operations again.

User Debugger
by
5.1k points

1 Answer

4 votes

Answer:

int i,j,k;

do{

scanf("%d %d",&i,&j);

k=i+j;

printf("%d",k);

scanf("%d",&k);

}while(k==1);

Step-by-step explanation:

First we initialize the 3 integers variables i,j,k

The loop starts

and we take input of numbers to be added into i and j

k stores the sum and prints it

Then we take an input of 0 (or) 1

0 indicates the user does not wish to perform the operation again

1 indicates the user wishes to perform the operation again

User Tangobravo
by
5.1k points