Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>TRATATATA</title>
- <script>
- var zgaduj = Math.floor((Math.random()*100)+1);
- //document.write(zgaduj);
- var ilosc = 10;
- while((ilosc <=10)&&(ilosc >=0)&&(proba!=zgaduj)){
- var proba = prompt("Wylosowałem liczbę z zakresu od 1 do 100. Masz " + ilosc + " prób, musisz ją odgadnąć");
- while(proba!=zgaduj){
- ilosc--;
- if(ilosc == 0){
- alert("Przegrałeś");
- }
- else if (ilosc > 0){
- if(proba>zgaduj){
- var proba = prompt("Mniej!" + ilosc);
- }
- else if (proba<zgaduj){
- var proba = prompt("Więcej!" + ilosc);
- }
- else{
- var proba = prompt("Nie wpisałeś liczby!" + ilosc);
- }
- }
- }
- }
- if(proba==zgaduj){
- document.write("Wygrałeś!");
- }
- </script>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement