import java.util.*;
public class MyClass {
public static void main(String[] args) {
Scanner wew = new Scanner(System.in);
int b = 0;
int i = 0;
System.out.println("Enter a number of row:");
b=wew.nextInt();
System.out.println("Enter a number of range:");
i=wew.nextInt();
for (int c = 1; c <= b; c++)
{
for (int g = 1; g <= i; g++){
System.out.println(g+"");
}
for ( int g = c-1; g >= 1; g--)
{
System.out.println(g+" ");
}
System.out.println();
}
}
}
该代码仍然超出我的知识范围。这就像一个斐波那契,我知道我的输出与预期结果相差太远
预期成绩:
Please enter a number range: 4
Please enter a number rows: 4
1111 2111 3111 4111
1211 1311 1411 1511
1131 1141 1151 1161
1114 1115 1116 1117