非常に単純ですが、理解できないようです。while ループを do-while に変換するだけです。目的は、1-9 と 9-1 を "1,22,333,4444" などとして印刷することです。
int y = 1;
int x = 1;
while (x < 10) {
y = 1;
while (y <= x) {
y++;
System.out.print(x + "");
}
System.out.println();
x++;
}
int a = 9;
int b = 1;
while (a >=1) {
b = 1;
while (b<= a) {
b++;
System.out.print(a + "");
}
System.out.println();
a--;
}
私の試みは 1-9 を出力しますが、単一の数字として無限に実行されますが、最初は 9 以降は何も出力しません。
int c = 1;
int d =1;
do { System.out.print(c +"");
c++;
System.out.println();
}
while (c<10);{
y=1;
while (d<=c);
}