public class Class04_Text {
public static void main(String[] args) {
//通过投三个骰子看看今天的手气
//通过Math.random()产生随机数
int i = (int)(6*Math.random()) + 1;
int j = (int)(6*Math.random()) + 1;
int k = (int)(6*Math.random()) + 1;
int count = i + j + k;
if(count > 15){
System.out.println("今天手气真好");
}
if(count <= 15 && count >= 10){
System.out.println("今天运气一般般");
}
if(count < 10){
System.out.println("今天手气真差");
}
System.out.println("得了"+count+"分");
}
}
投三次骰子看运气如何
最新推荐文章于 2024-07-20 23:59:39 发布