1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package practiceGO;
/* * A
* AB
* ABC
* ABCD
* ABCDE
*/
public class Cto {
public static void main(String[] args) {
for ( int i= 0 ; i< 5 ; i++){
for ( int j= 0 ; j<(i+ 1 ); j++){
char ch = 'A' ;
System.out.print(( char )(ch+j));
}
System.out.println();
}
}
} |
运行结果:
1
2
3
4
5
|
A AB ABC ABCD ABCDE
|
本文转自yeleven 51CTO博客,原文链接:http://blog.51cto.com/11317783/1769208