<pre name="code" class="java">
import java.util.Scanner;
/**
* 七星彩随机选号程序
*
*@刘顺
*/
public class Test05 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("机选几注: ");
//if这一句也可写成for(;sc.hasNextInt();)
//if括号里只写为真的条件
if(sc.hasNextInt()) {
int n = sc.nextInt();
if(n > 0) {
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= 7; j++) {
System.out.print((int)(Math.random() * 10) + " ");
}
System.out.println();
}
}
}
else{System.out.println("你輸入錯誤!!!");}
sc.close();
}
}