Answer to Question #256664 in Algorithms for Dion Martins

Question #256664

1.1 Rewrite the following using the specified looping structure/s:

1.1.1 Use pre-test (for-loop) and a post-test (do-loop until).

num1 = 20

do while x <= -15

display “x = “, x

x = x - 3

loop


1.1.2 Use pre-test (do-while) and a post-test (do-loop until).

for value = 5 to -15 step - 3

display “x = “, x

next value


1
Expert's answer
2021-10-25T17:56:40-0400

1.1.1

for num1 = 20 to -15 step -3
    display "x = ", num1
next num1


num1 = 20
do 
    display "x = ", num1
    num1 = num1 - 3
Loop while num1 > -15


1.1.2

value = 5
do while value >= -15
    display "x = ", value
    value = value - 3
loop


value = 5
do 
    display "x = ", value
    value = value - 3
loop while value > -15

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS