首页 > 其他 > 详细

显示字符 Exercise06_12

时间:2018-12-25 14:51:49      阅读:145      评论:0      收藏:0      [点我收藏+]
 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 }

 

显示字符 Exercise06_12

原文:https://www.cnblogs.com/cherrydream/p/10173828.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!