HW3.14

HW3.14

HW3.14

 import java.util.Scanner;

 public class Solution
 {
     public static void main(String[] args)
     {
         Scanner input = new Scanner(System.in);

         System.out.println("Please guess the coin, 0 for negative and 1 for positive: ");
         int number = input.nextInt();

         input.close();

         int judgment = (int)(Math.random() * 101);

         if(judgment <= 50)
             judgment = 0;
         else
             judgment = 1;

         if(number == judgment)
             System.out.println("True");
         else
             System.out.println("False");
     }
 }
上一篇:打开固定文件的pr_debug


下一篇:五分钟学Java:可变参数究竟是怎么一回事?