Give output for the following. for(int i=0;i<=5;++). {. System.out.println("i=" +i); }
Answers
Answered by
0
Answer:
Output:-
i=0
i=1
i=2
i=3
i=4
i=5
Steps how it executed:-
initially the value is 0 then the condition is checked if it is true then i is executed so 0 is executed.In the same way 1 is executed till 5 now i becomes 6 and 6<=5 which is false hence the numbers from 0-5 is executed.
Similar questions