Ask Question
29 September, 21:52

declare integer product declare integer number product = 0 do while product < 100 display ""Type your number"" input number product = number * 10 loop display product End While

+4
Answers (1)
  1. 29 September, 22:10
    0
    Full Question

    1. Correct the following code and

    2. Convert the do while loop the following code to a while loop

    declare integer product

    declare integer number

    product = 0

    do while product < 100

    display ""Type your number""

    input number

    product = number * 10

    loop

    display product

    End While

    Answer:

    1. Code Correction

    The errors in the code segment are:

    a. The use of do while on line 4

    You either use do or while product < 100

    b. The use of double "" as open and end quotes for the string literal on line 5

    c. The use of "loop" statement on line 7

    The correction of the code segment is as follows:

    declare integer product

    declare integer number

    product = 0

    while product < 100

    display "Type your number"

    input number

    product = number * 10

    display product

    End While

    2. The same code segment using a do-while statement

    declare integer product

    declare integer number

    product = 0

    Do

    display "Type your number"

    input number

    product = number * 10

    display product

    while product < 100
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “declare integer product declare integer number product = 0 do while product < 100 display ""Type your number"" input number product = ...” in 📗 Engineering if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers