Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. package Probability;
  2.  
  3. import java.util.Random;
  4.  
  5. public class Probability {
  6.     int los=0;
  7.     int max=5;
  8.     int licznik=0;
  9.    
  10.     Random generator = new Random();
  11.    
  12.     Probability() {}
  13.    
  14.     void main(String[] args) {
  15.         int cel = generator.nextInt( max );
  16.        
  17.         do {
  18.             los = generator.nextInt( max );
  19.             licznik++;
  20.         } while (los != cel);
  21.        
  22.         System.out.println("Dana liczbe trafiono za " + licznik + " razem (sposrod " + licznik + ").");
  23.     }  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement