Computer Science, asked by rockingtrishala5625, 1 year ago

predict the output
int m=2;
int n=15;
for(int i=1;i<5;i++)
m++;--n;
System.out.println("m="+m);
System.out.println("n="+n);

Answers

Answered by aqibkincsem
77

The output will be, m=6, n=14 Since there is no braces given for the loop, it means only m++ is the part of the loop.


The statement --n is not the part of the loop and hence gets decremented only one.


Since, m++ is it gets incremented for 5 times, i.e when the loop statement is true.

Answered by tiyasha142005
22

Answer:

m=6 ; n =14 is the answer

Explanation:

since there are no braces so m is the part of the loop and --n is not the output

Similar questions