Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- </head>
- <body>
- <script>
- let l = 1;
- let p = 100;
- let srednia=Math.floor((p+l)/2);
- var szukana=prompt("Podaj liczbe z zakresu 1-100");
- while(szukana>100 || szukana<1)
- {
- szukana=prompt("NIEPRAWIDŁOWA LICZBA! \nPodaj liczbe z zakresu 1-100");
- }
- var czy_to_ta=confirm("Czy myślisz o "+srednia+"?");
- while(czy_to_ta==false)
- {
- czy_to_ta=confirm("Czy jest ona większa od"+srednia+"?")
- if(czy_to_ta)
- {
- l = srednia+1;
- }
- else
- {
- p = srednia;
- }
- srednia = Math.floor ((l+p)/2);
- czy_to_ta = confirm("czy myslisz o "+srednia+"?");
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement