pp8.3 column

来源:互联网 发布:shake it是什么意思 编辑:程序博客网 时间:2024/06/06 23:54

package qsy;
import java.util.Scanner;


public class column {
 public static void main(String[] args) {
  String choose = "y";
 
  Scanner scan = new Scanner(System.in);
  String[] column = new String[10];
  for (int index = 0; index < column.length; index++)
   column[index] = "";
  while (choose.equalsIgnoreCase("y")) {
   System.out.print("请输入一个1-100的数:");
   int num = scan.nextInt();scan.nextLine();
   if (0<num&&num<101)
   column[num / 10] += "*";
   else
    System.out.print("请重新输入");
   System.out.print("是否继续输入数字?(y/n)");
   choose = scan.nextLine();
   
  }
  scan.close();

  for (int row = 0; row < 10; row++) {
   System.out.print((row*10+1)+"-"+(row*10+10)+"|");
    System.out.println(column[row] + "\t");
   
  }
 }
}

 

0 0
原创粉丝点击