1 package 课上程序; 2 3 /** 4 * 5 * 七星彩选号 6 * @author 王启文 7 * 8 */ 9 10 import java.util.Scanner; 11 12 public class qixincaixuanhao { 13 public static void main(String[] args) { 14 Scanner sc = new Scanner(System.in); 15 System.out.print("请输入您需要的注数:\n"); 16 if (sc.hasNextInt()) { 17 int a = sc.nextInt(); 18 if (a > 0) { 19 for (int j = 1; j <= a; ++j) { 20 System.out.printf("第%d注为:", j); 21 for (int i = 1; i <= 7; ++i) { 22 int b = (int) (Math.random() * 10); 23 System.out.print(" " + b); 24 } 25 System.out.println(); 26 } 27 } 28 } 29 sc.close(); 30 } 31 }
时间: 2024-11-05 18:53:07