Question: Convert the Do - while loop in the following code to a while loop: Declare String sure Do Display Are you sure you want to

Convert the Do-while loop in the following code to a while loop:
Declare String sure
Do
Display "Are you sure you want to quit?"
Input sure
While sure !="Y" AND sure "Y"
Convert the following while loop to a For loop:
Declare Integer count =0
While count 50
Display "The count is ", count
Set count = count +1
End While
Convert the following For loop to a while loop:
Declare Integer count
For count =1 To 50
Display count
End For Find the error in the following pseudocode.
Declare Boolean finished = False
Declare Integer value, cube
While NOT finished
Display "Enter a value to be cubed."
Input value;
Set cube = value^3
Display value, " cubed is ", cube
End While
The programmer intended the following pseudocode to display the numbers 1
through 60, and then display the message "Time's up!" It will not function as
intended, however. Find the error.
Declare Integer counter =1
Const Integer TIME_LIMIT =60
While counter TIME_LIMIT
Display counter
Set counter = counter +1
End While
Display "Time's up!" The programmer intended the following pseudocode to get five sets of two
numbers each, calculate the sum of each set, and calculate the sum of all the
numbers entered. It will not function as intended, however. Find the error.
// This program calculates the sum of five sets of two numbers.
Declare Integer number, sum, total
Declare Integer sets, numbers
Constant Integer MAX_SETS =5
Constant Integer MAX_NUMBERS =2
Set sum =0;
Set total =0;
For sets =1 To MAX_NUMBERS
For numbers =1 TO MAX_SETS
Display "Enter number ", numbers, " of set ", sets, "."
Input number;
Set sum = sum + number
End For
Display "The sum of set ", sets, " is ", sum, "."
Set total = total + sum
Set sum =0
End For
Display "The total of all the sets is ", total, "."Algorithm Workbench
Design a while loop that lets the user enter a number. The number should be
multiplied by 10, and the result stored in a variable named product. The loop
should iterate as long as product contains a value less than 100.
Design a Do-while loop that asks the user to enter two numbers. The numbers
should be added and the sum displayed. The loop should ask the user whether he
or she wishes to perform the operation again. If so, the loop should repeat;
otherwise it should terminate.
Design a For loop that displays the following set of numbers:
0,10,20,30,40,50,dots,1000
Design a loop that asks the user to enter a number. The loop should iterate 10
times and keep a running total of the numbers entered.
Design a For loop that calculates the total of the following series of numbers:
130+229+328+dots+301
Design a nested loop that displays 10 rows of # characters. There should be 15 #
characters in each row.
Convert the while loop in the following code to a Do-while loop:
Declare Integer x=1
While x>0
Display "Enter a number.
Input
End While
Convert the Do - while loop in the following code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!