CBSE Class 11 Computer Science Question 104 of 161

Flow of Control — Question 13

Back to all questions
13
Question

Question 10b

Rewrite following code fragment using while loops :

for i in range(1, 16) :
  if i % 3 == 0 :      
     print (i)

Answer

i = 1
while i < 16:
    if i % 3 == 0 :
        print (i)
    i += 1
Answer