Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package kolo;
  2.  
  3. import java.util.Scanner;
  4. import java.lang.Math;
  5.  
  6. public class ta {
  7.  
  8. public static void main(String[] args) {
  9.  
  10. Scanner sc = new Scanner(System.in);
  11. int random = (int)(Math.random()*21)+20;
  12. int liczba=0;
  13. for(;liczba!=random;)
  14. {
  15. System.out.println("Podaj liczbe:");
  16. liczba = sc.nextInt();
  17.  
  18. if(liczba>random)
  19. System.out.println("Za duzo!");
  20. else if(liczba<random)
  21. System.out.println("Za malo!");
  22. else
  23. System.out.println("Zgadles!");
  24. }
  25. sc.close();
  26.  
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement