码迷,mamicode.com
首页 > 其他好文 > 详细

HW3.14

时间:2016-08-12 13:15:53      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

技术分享

 

 1 import java.util.Scanner;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         Scanner input = new Scanner(System.in);
 8 
 9         System.out.println("Please guess the coin, 0 for negative and 1 for positive: ");
10         int number = input.nextInt();
11 
12         input.close();
13 
14         int judgment = (int)(Math.random() * 101);
15 
16         if(judgment <= 50)
17             judgment = 0;
18         else
19             judgment = 1;
20 
21         if(number == judgment)
22             System.out.println("True");
23         else
24             System.out.println("False");
25     }
26 }

 

HW3.14

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5764358.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!