HW4.40

时间:2023-03-09 16:00:11
HW4.40

HW4.40

 public class Solution
 {
     public static void main(String[] args)
     {
         long positiveSide = 0;
         long negativeSide = 0;
         int side;

         for(long i = 0; i < 1000000; i++)
         {
             side = (int)(Math.random() * 2);
             if(side == 1)
                 positiveSide++;
             else
                 negativeSide++;
         }

         System.out.println("The count of positive side is " + positiveSide);
         System.out.println("The count of negative side is " + negativeSide);
     }
 }