-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontador-opcoes.js
executable file
·41 lines (30 loc) · 1.07 KB
/
contador-opcoes.js
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
29
30
31
32
33
34
35
36
37
38
39
40
41
const readline = require('readline-sync')
console.log("._________________________________. ")
console.log("| Escolha uma opção de contador |")
console.log("| |")
console.log("| [1] Para contar de 1 ate 10 |")
console.log("| [2] Para contar de 10 ate 1 |")
console.log("| [3] Sair |")
console.log("|_________________________________|")
let opcao = readline.questionInt("Opção: ")
if(opcao < 1 || opcao > 3) {
opcao = console.log("Opção inálida. Escolha uma das opções sugeridas. ")
} else {
switch(opcao) {
case 1:
console.log("Contagem de 1 até 10 ")
for(let c = 1; c <= 10; c++){
console.log(c)
}
break
case 2:
console.log("Contagem de 10 até 1 ")
for(let c = 10; c >= 1; c--){
console.log(c)
}
break
default:
console.log("Você saiu do programa. ")
break
}
}