0
Please help me making code for this pattern
1 22 333 4444 55555
7 Respostas
+ 2
If you want a pyramid you'll need more numbers:
int max = 5;
for(int i = 1; i <= max; i++){
for(int t = 0; t < max-i; t++){
System.out.print(" ");
}
for(int t = 0; t < i*2-1; t++){
System.out.print(i);
}
System.out.println();
}
0
Well, it'll probably not line up like this as ' ' (empty space) is normaly as big as every other character if you output to the console, but here you go:
int max = 5;
for(int i = 1; i <= max; i++){
for(int t = 0; t < max-i; t++){
System.out.print(" ");
}
for(int t = 0; t < i; t++){
System.out.print(i);
}
System.out.println();
}
0
not working bro
0
You did copy this into the main method and used java to run it, right?
0
lining is not probably but totally different .
Its
1
22
333
4444
55555
0
Told you, but look what happens if you copy the output into this answer field:
1
22
333
4444
55555
Exactly what you wrote!
0
yup.. you are right.. thanks for help.