Int x=10; while(x<20) { if(++x%5==0)continue; System.out.print(" "+x); x++; }
Answers
Answered by
2
Answer:
Explanation:
x=10
if(11%5==0) -> false
print 11
x++ -> x=12
if(13%5==0) ->false
print 13
x++ -> x=14
*************************
if(15%5==0) -> true
continue
*****************************
if(16%5==0) ->false
print 16
x++ -> x=17
******************************
if(18%5==0)->false
print 18
x++ -> x=19
******************************
if(20%5==0) -> true
continue
********************************
while(20<20) ->false
loop breaks;
while condn is checked each time ****************
so output is
11 13 16 18
Hope it helps :-)
Similar questions
Social Sciences,
6 months ago
English,
6 months ago
Computer Science,
1 year ago
Science,
1 year ago