Varasku

Za dużo, za mało (Chyba)

Oct 25th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1.  
  2. package pętlee9;
  3.  
  4. import java.util.Random;
  5. import java.util.Scanner;
  6.  
  7.  
  8. public class PętleE9 {
  9.  
  10. public static void main(String[] args) {
  11.  
  12.  
  13. Random r = new Random ();
  14. int wylosowana;
  15.  
  16. wylosowana = r.nextInt(100);
  17.  
  18. Scanner sc=new Scanner(System.in);
  19. int liczba;
  20. do{
  21. System.out.println("Podaj liczbe: ");
  22. liczba=sc.nextInt();
  23. if (wylosowana<liczba)
  24. System.out.println("Za mało");
  25. else
  26. if(wylosowana>liczba)
  27. System.out.println("Za dużo");
  28. else
  29. System.out.println("Ideolo");
  30.  
  31.  
  32. }
  33. while(wylosowana!=liczba);
  34. System.out.println("Wylosowana liczba: "+wylosowana);
  35.  
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment