采彩票(if else)
import java.util.Scanner;
public class MathRandomTest {
public static void main(String[] args){
Scanner number = new Scanner(System.in);
System.out.println("请输入要买进的数字");
int guess = number.nextInt();
int random = (int)(Math.random()*90+10);
int shiwei = guess/10;
int gewei = guess%10;
System.out.println("中奖数字:"+random);
if(shiwei*10+gewei == random){
System.out.println("奖金10000元");
} else if(shiwei == (random%10) || gewei ==(random/10)){
System.out.println("奖金3000元");
} else if(shiwei == (random/10) || gewei == (random%10)){
System.out.println("奖金1000元");
} else if(shiwei == (random%10) || gewei == (random/10)){
System.out.println("奖金500元");
} else{
System.out.println("彩票作废");
}
}
}