Skip to content

Commit b972123

Browse files
committed
[Shreyash]: Added code to print numbers 1, 10, 100, 1000,... in words
1 parent 0454a08 commit b972123

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
Read Number from (1, 10, 100, 1000, 10000) and display unit, ten, hundred,...
3+
*/
4+
5+
const prompt = require("prompt-sync")();
6+
console.log();
7+
var num = prompt(" Enter the number from (1, 10, 100, 1000, 10000) : ");
8+
if (num == 1) {
9+
console.log(" ", num, ": Unit \n");
10+
} else if (num == 10) {
11+
console.log(" ", num, ": Ten \n");
12+
} else if (num == 100) {
13+
console.log(" ", num, ": One Hundred \n");
14+
} else if (num == 1000) {
15+
console.log(" ", num, ": One Thousand \n");
16+
} else if (num == 10000) {
17+
console.log(" ", num, ": Ten Thousand \n");
18+
} else {
19+
console.log(" Invalid Number \n");
20+
}

0 commit comments

Comments
 (0)