Computer Science, asked by Pruth, 11 months ago

answer this plz................ question (d)​

Attachments:

Answers

Answered by Anonymous
0

Ans:

4 2

Iterations 5...


Pruth: but why??
Pruth: reason???
Pruth: answer plz
Answered by siddhartharao77
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!


Pruth: how can 4 be printed
siddhartharao77: If the statement is true, then continue statement is executed. if it is false, then system.out.println will be executed
Similar questions