两位数的彩票代码
作者:互联网
import java.util.Scanner;
public class CaiPiaoTest {
public static void main(String[] args) {
//System.out.println(Math.random());//产生[0,1)
int num=(int)(Math.random()*90+10);
int numGW=num%10;
int numSW=num/10;
Scanner scan=new Scanner(System.in);
System.out.println("请输入一个两位数:");
int guess=scan.nextInt();
int guessGW=guess%10;
int guessSW=guess/10;
if (numGW==guessGW && numSW==guessSW){
System.out.println("奖金10 000美元");
}else if (numGW==guessSW && numSW==guessGW){
System.out.println("奖金3000美元");
}else if (numGW==guessGW || numSW==guessSW){
System.out.println("奖金1000美元");
}else if (numGW==guessSW || numSW==guessGW){
System.out.println("奖金500美元");
}else{
System.out.println("很抱歉,本期彩票您未中奖");
}
System.out.println("本期彩票为:"+num);
}
}
标签:10,guessGW,int,代码,System,两位数,彩票,println,out 来源: https://www.cnblogs.com/Cienu7u/p/15686027.html