Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pętlee9;
- import java.util.Random;
- import java.util.Scanner;
- public class PętleE9 {
- public static void main(String[] args) {
- Random r = new Random ();
- int wylosowana;
- wylosowana = r.nextInt(100);
- Scanner sc=new Scanner(System.in);
- int liczba;
- do{
- System.out.println("Podaj liczbe: ");
- liczba=sc.nextInt();
- if (wylosowana<liczba)
- System.out.println("Za mało");
- else
- if(wylosowana>liczba)
- System.out.println("Za dużo");
- else
- System.out.println("Ideolo");
- }
- while(wylosowana!=liczba);
- System.out.println("Wylosowana liczba: "+wylosowana);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment