Given below is a for loop. Write an equivalent while loop that gives the same output.                         for i in range(3):                                     print(i * 2)

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter5: Control Structures Ii (repetition)
Section: Chapter Questions
Problem 34SA
icon
Related questions
Question

Given below is a for loop. Write an equivalent while loop that gives the same output.

                        for i in range(3):

                                    print(i * 2) 

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer