Skip to content

Commit 126b6b4

Browse files
committed
[Shreyash]: Added code to print week day according to number entered using switch case
1 parent 29be565 commit 126b6b4

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
Read Number and Display the week day (Sunday, Monday,...)
3+
*/
4+
5+
var prompt = require("prompt-sync")();
6+
console.log();
7+
let num = parseInt(prompt(" Enter the Day number : "));
8+
9+
switch (num) {
10+
case 1:
11+
console.log(" Sunday \n");
12+
break;
13+
case 2:
14+
console.log(" Monday \n");
15+
break;
16+
case 3:
17+
console.log(" Tuesday \n");
18+
break;
19+
case 4:
20+
console.log(" Wednesday \n");
21+
break;
22+
case 5:
23+
console.log(" Thursday \n");
24+
break;
25+
case 6:
26+
console.log(" Friday \n");
27+
break;
28+
case 7:
29+
console.log(" Saturday \n");
30+
break;
31+
default:
32+
console.log(" Invalid Number \n");
33+
break;
34+
}

0 commit comments

Comments
 (0)