Skip to content

Commit ae2c0f2

Browse files
committed
[Shreyash]: Added code to check entered year is leap year or not
1 parent 7801e7b commit ae2c0f2

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
Check if year is Leap or not
3+
*/
4+
5+
const prompt = require("prompt-sync")();
6+
console.log();
7+
let year = (prompt(" Enter year : "));
8+
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
9+
console.log(" " + year + " is a leap year \n");
10+
} else {
11+
console.log(" " + year + " is not a leap year \n");
12+
}

0 commit comments

Comments
 (0)