Computer Science, asked by gvb93, 3 months ago

What is the output of the following code fragment ?
for (int i = 1; i < 10 ; i++)
System.out.println (i);​

Answers

Answered by adityaraut949
4

This prints all the numbers from 1 to 10 using for loop. Using for loop the value of I is incremented by one till 10 and print I to the screen.

Answered by durgeshbishi2
1

Answer:

1

2

3

4

5

6

7

8

9

Explanation: As we know, the for loop takes i=1 in the first step. It prints the value stored in i, which is 1. Then it adds 1 to i by the statement "i++". Now it checks if i is less than 10. If yes, it does the thing written in for loop, that is print i, otherwise, it stops for a loop.

#SPJ3

Similar questions