N
noob222
Gast
Hallo, hab eine Progra Aufgabe die ich nicht lösen kann.
Ich soll eine Pyramide der Form programmieren:
1
121
12321
1234321
ich krieg das nicht hin. bin noch ein anfänger in java.
bei mir kommt raus:
0
11
222
3333
44444
555555
6666666
könnt ihr mir helfen?
mein code sieht so aus:
public class Pyramide {
public static void main(String[] args) {
int i;
int j;
for(i = 0; i <= 3; i++) {
for(j = 0; j <= 6; j++)
System.out.print(" ");
for(j = 0; j <= i; j++)
System.out.print(j + " ");
System.out.println();
}
}
}
Ich soll eine Pyramide der Form programmieren:
1
121
12321
1234321
ich krieg das nicht hin. bin noch ein anfänger in java.
bei mir kommt raus:
0
11
222
3333
44444
555555
6666666
könnt ihr mir helfen?
mein code sieht so aus:
public class Pyramide {
public static void main(String[] args) {
int i;
int j;
for(i = 0; i <= 3; i++) {
for(j = 0; j <= 6; j++)
System.out.print(" ");
for(j = 0; j <= i; j++)
System.out.print(j + " ");
System.out.println();
}
}
}