Last active
May 6, 2024 15:09
-
-
Save alanmugiwara/b01e14ea3c7da4d24e1f8a5442b1ef87 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <meta charset="UTF-8"> | |
| <script> | |
| function pulaLinha() { | |
| document.write('<br>'); | |
| } | |
| function mostra(txt) { | |
| document.write(txt); | |
| pulaLinha(); | |
| } | |
| function sorteia () { | |
| return Math.round(Math.random() *20); | |
| } | |
| var n = sorteia(); | |
| console.log(n); | |
| var chute = parseInt(prompt('Digite seu chute!')); | |
| while (chute !== n) { | |
| if (chute > n) { | |
| mostra('O número é menor!'); | |
| } else { | |
| mostra('O número é maior!'); | |
| } | |
| chute = parseInt(prompt('Digite seu chute!')); | |
| } | |
| mostra('Acertou!'); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment