Computer Science, asked by rifatjamal157, 7 months ago

Give the output for the follwing:
for (int x=0;x<3;x++)
for(int y=x;y<2;y++)
System.out.print(x+" ");
System.out.println(y);

Answers

Answered by erika5
3

Explanation:

0,1,2 0,1

for (int x=0;x<3;x++)

for this line, x = 0 and x is less than 3

that means x will start from 0 and end with 2..

as ++ sign is there so it will continue from 0 to 2..

print is there in the 3rd line so the line will not change.

for(int y=x;y<2;y++)

for this line y = x that means it will be same as x..so it will also start from 0 but ,as y less than 2 so it will end with 1..

plzzz mark brainliest and follow

Similar questions