18. Rewrite the following code fragment using while loop:
for i in range(1, 16) :
if i%3 ==0:
print(i)
Answers
Answered by
16
This quite an easy loop and answer is here.
Attachments:
Answered by
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
Computer Science,
6 months ago
Physics,
1 year ago
Social Sciences,
1 year ago
Math,
1 year ago
Math,
1 year ago