detect the output
i =1
while ( i <=1)
{
i ++
SOP (1)
}
SOP ( i )
Answers
Answered by
1
output
12 if SOP(System.out.print)
otherwise if SOP(System.out.println)
1
2
____________________
initial value of i=1.
while(i<=1)
it check the condition if i is less than or equal to 1 than the loop run otherwise not.
so for first check pass out(enter to loop due i=1) to.
now
i++ means i=i+1 so i=2.
and sop (system.out.print)
SOP(1) will print 1 but no line change.
and after coming out loop i=2 so while loop not run now.
SOP(i) print 2
so it's output become.
12
12 if SOP(System.out.print)
otherwise if SOP(System.out.println)
1
2
____________________
initial value of i=1.
while(i<=1)
it check the condition if i is less than or equal to 1 than the loop run otherwise not.
so for first check pass out(enter to loop due i=1) to.
now
i++ means i=i+1 so i=2.
and sop (system.out.print)
SOP(1) will print 1 but no line change.
and after coming out loop i=2 so while loop not run now.
SOP(i) print 2
so it's output become.
12
Attachments:
![](https://hi-static.z-dn.net/files/d05/6aa03caf1d0ee58289700f3b3ec67733.jpg)
![](https://hi-static.z-dn.net/files/dc2/9a9c117699445275b30fbce67445dbd7.jpg)
RiyaWani:
sorry how did u got this ans
Similar questions