显示字符 Exercise06_12

 1 /**
 2  * @author 冰樱梦
 3  * 时间:2018年下半年
 4  * 题目:显示字符
 5  *1 2 3 4 5 6 7 8 9 : 
 6 ; < = > ? @ A B C D 
 7 E F G H I J K L M N 
 8 O P Q R S T U V W X 
 9 Y Z 
10  */
11 public class Exercise06_12 {
12     public static void main(String[] args){
13         printChars( '1', 'Z',10);
14     }
15     public static void printChars(char ch1,char ch2,int numberPerLine){
16         int sum=0;
17         for(char i=ch1;i<=ch2;i++){
18             System.out.print(i+" ");
19             sum++;
20             if(sum%numberPerLine==0){
21             System.out.print("\n");
22             }
23         }
24     }
25 }

猜你喜欢

转载自www.cnblogs.com/cherrydream/p/10173828.html