answer this plz................ question (d)
Attachments:
Answers
Answered by
0
Ans:
4 2
Iterations 5...
Pruth:
but why??
Answered by
1
Sample Program:
int i;
for(int i = 5; i >= 1; i--)
{
if(i%2 == 1)
continue;
System.out.println(i+ " ");
}
Explanation:
(i) 5 >= 1(True)
5%2 == 1 ------ True
Continue -------------- Skips Statement
(ii) 4 >= 1
4%2 == 1 ---- (False)
System.out.println(4); ----------- Printed
(iii) 3 >= 1
3%2 == 1 ----- True
Continue --------- Skips Statement
(iv) 2 >= 1
2%2 == 1 -------- False
System.out.println(2); ---------------- Evaluated
(v) 1 >= 1
1%2 == 1 ------ True
Continue --------------- Skips Statement.
Output:
4
2
Hope it helps!
Similar questions