Advertisement
Guest User

cw06z02

a guest
Oct 18th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.97 KB | None | 0 0
  1. //cw06z02
  2. //wykonaj 5 losowan, po kazdym losowaniu program ma wypisac
  3. //czy wszystkie 3 ostatnie wyniki losowan byly wieksze od 0.2
  4. public class cw06z02
  5.     {
  6.         public static void main ( String[] args)
  7.         {
  8.             double x1 = Math.random();
  9.             double x2 = Math.random();
  10.             double x3 = Math.random();
  11.             double x4 = Math.random();
  12.             double x5 = Math.random();
  13.            
  14.             if( (x1>0.2) && (x2>0.2) && (x3>0.2) )
  15.             {
  16.                 System.out.println("(T)Pierwsze 3. losowania > 0.2");
  17.             }else
  18.             {
  19.                 System.out.println("(N)Pierwsze 3. losowania NIE sa > 0.2");
  20.             }
  21.            
  22.                         if( (x2>0.2) && (x3>0.2) && (x4>0.2) )
  23.             {
  24.                 System.out.println("(T)Drugie 3. losowania > 0.2");
  25.             }else
  26.             {
  27.                 System.out.println("(N)rugie 3. losowania NIE sa > 0.2");
  28.             }
  29.            
  30.                         if( (x3>0.2) && (x4>0.2) && (x5>0.2) )
  31.             {
  32.                 System.out.println("(T)Trzecie 3. losowania > 0.2");
  33.             }else
  34.             {
  35.                 System.out.println("(N)Trzecie 3. losowania NIE sa > 0.2");
  36.             }
  37.            
  38.         }  
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement