Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //cw06z02
- //wykonaj 5 losowan, po kazdym losowaniu program ma wypisac
- //czy wszystkie 3 ostatnie wyniki losowan byly wieksze od 0.2
- public class cw06z02
- {
- public static void main ( String[] args)
- {
- double x1 = Math.random();
- double x2 = Math.random();
- double x3 = Math.random();
- double x4 = Math.random();
- double x5 = Math.random();
- if( (x1>0.2) && (x2>0.2) && (x3>0.2) )
- {
- System.out.println("(T)Pierwsze 3. losowania > 0.2");
- }else
- {
- System.out.println("(N)Pierwsze 3. losowania NIE sa > 0.2");
- }
- if( (x2>0.2) && (x3>0.2) && (x4>0.2) )
- {
- System.out.println("(T)Drugie 3. losowania > 0.2");
- }else
- {
- System.out.println("(N)rugie 3. losowania NIE sa > 0.2");
- }
- if( (x3>0.2) && (x4>0.2) && (x5>0.2) )
- {
- System.out.println("(T)Trzecie 3. losowania > 0.2");
- }else
- {
- System.out.println("(N)Trzecie 3. losowania NIE sa > 0.2");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement