This is a simple program i wrote using for loop
public class Test
{
public static void main (String[] args)
{
int high=10;
for( int low =0; low <=high; low++){
for (int mid=0; mid<=high; mid++)
{
System.out.print(mid);
}
System.out.println();
}
}
}
But I want the output to look like
0 1 2 3 4 5 6 7 8 9 10
1 2 3 4 5 6 7 8 9 10
2 3 4 5 6 7 8 9 10
etc...
10
Instead my output looks like this 012345678910012345678910012345678910012345678910012345678910012345678910012345678910012345678910012345678910012345678910012345678910
What am i doing wrong?
mid=lowin the second loop and you are also missing the opening{for the same loop.