Chapter 5 Homework
Write a pseudocode solution for each of these problems.
- Design a While loop that lets that 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. Computer Science homework help
- Design a For loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 ….. 100.
- Design a nested loop that displays 10 rows of # characters. There should be 15 # characters in each row.
ORDER A PLAGIARISM FREE PAPER NOW
- Convert this For loop to a While loop.
Declare Integer count
For count = 1 to 50
- 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.”
Set cube = value ^ 3
Display value, “ cubed is “, cube
- 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
Set counter = counter + 1
Display “Time’s up!”
- A bug collector collects bugs every day for seven days. Design a solution that keeps a running total of the number of bugs collected during the seven days. The loop should ask for the number of bugs collected for each day, and when the loop is finished, the program should display the total number of bugs collected. Computer Science homework help