200k views
1 vote
Write a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the user should be asked if he or she wishes to perform the operation again. if so the loop should repeat; otherwise it should terminate.

User InPursuit
by
8.5k points

1 Answer

2 votes
Main
//declare variables
Declare String do Again
//Add the user numbers as many times as needed Do
Call myFunction (num1, num2, sumNumbers)
Display “Would you like to add more numbers?”
Display “(Enter y for yes):”
Input do Again
While do Again == ”y”
End Module
//This module will ask the user for two numbers
then add them together and display the results
Module my Function()
//Declare Variables
Declare Integer num1 = 0
Declare Integer num2 = 0
Declare Integer sumOfBoth = 0
//Ask for user input
Display “Please enter your 1 st number: “
Input num1
Display “Please enter your 2 nd number: “
Input num2
Set sum Of Both = num1 + num2
Display num1 “ + “ num2 “ = “sum Of Both
End Module
User Davemyron
by
8.3k points