first commit with existing project files
This commit is contained in:
17
algo_js/nombre_cache.js
Normal file
17
algo_js/nombre_cache.js
Normal file
@@ -0,0 +1,17 @@
|
||||
const prompt = require('prompt-sync')();
|
||||
|
||||
// Deviner le nombre caché
|
||||
|
||||
let nombreCache = Math.floor(Math.random() * 100);
|
||||
|
||||
let propostion = parseInt(prompt("Devinez le nombre caché entre 1 et 100 :"));
|
||||
|
||||
while (propostion != nombreCache) {
|
||||
|
||||
if (propostion < nombreCache) console.log("C'est plus grand !");
|
||||
else if (propostion > nombreCache) console.log("C'est plus petit !");
|
||||
|
||||
propostion = prompt("Réessayez :");
|
||||
}
|
||||
|
||||
if (propostion == nombreCache) console.log("Bravo ! Vous avez deviné le nombre caché !");
|
||||
Reference in New Issue
Block a user