Computer Science, asked by anikarana18, 1 year ago

18. Rewrite the following code fragment using while loop:
for i in range(1, 16) :
if i%3 ==0:
print(i)

Answers

Answered by ojthapa10gmailcom
16

This quite an easy loop and answer is here.

Attachments:
Answered by Anonymous
6
  • The answer to the code fragment is:

int i;

while ( i < = 16 )

{  if ( i % 3 = = 0 )

   cout<<i;

   i++

}

  • The syntax for the while loop is:

while ( condition )

{  // body of the loop

  // statements that are to be executed

Increment / Decrement

}

Similar questions