HW3.14

时间:2022-04-05 18:56:51

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");
     }
 }

相关文章