-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion11.js
More file actions
28 lines (18 loc) · 773 Bytes
/
Question11.js
File metadata and controls
28 lines (18 loc) · 773 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* 11. Escreva um algoritmo para ler uma quantidade indeterminada de valores inteiros. Para cada valor fornecido escrever uma mensagem que indica se cada valor fornecido é PAR ou ÍMPAR. O algoritmo será encerrado imediatamente após a leitura de um valor NULO ou NEGATIVO.
*/
const prompt = require('prompt-sync')();
function readValues (){
do{
Numbers = parseInt(prompt("Type the Number: "));
if(Numbers === null || Numbers < 0 || isNaN(Numbers)){
console.log("Please! Type the Number.");
break;
}else if(Numbers%2 ===0){
console.log(Numbers," is Even.");
}else{
console.log(Numbers," is Odd.");
}
}while(true);
}
readValues();