1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
package 本章总结;
import java.util.Scanner;
public class A01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in = new Scanner (System.in);
System.out.println( "请输入打印行数:" );
int rows =in.nextInt();
for ( int i = 1 ; i <=rows; i++) {
for ( int j = 1 ; j <=i; j++) {
System.out.print(j+ " " );
}
System.out.println();
}
}
} |
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1426314