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(); } } }
运行结果:
A AB ABC ABCD ABCDE
时间: 2024-10-09 12:11:27