class Untitled {
public static void main(String[] args) {
for(int i = 1; i < 10; i++) {
for(int j = 1; j <= i; j++) {
System.out.print(j + "\t");
}
System.out.println();
}
}
}
运行结果
public class MainPrint {
public static void main(String[] args) {
for(int i = 1; i <= 10; i++){
for(int j = 1; j < i; j++){
System.out.print(j + " ");
}
System.out.println();
}
}
}
两个循环搞掂,觉得有用请采纳一下哈!!!
class Untitled {
public static void main(String[] args) {
for(int i = 1; i < 10; i++) {
for(int j = 1; j <= i; j++) {
System.out.print(j + "\t");
}
System.out.println();
}
}
}