You will be provided with a number. Print the number of days in the month corresponding to that number.
You will be provided with a number. Print the number of days in the month corresponding to that number.
Note: In case the input is February, print 28 days. If the Input is not in valid range print "Error".
Input Description:
The input is in the form of a number.
Output Description:
Find the days in the month corresponding to the input number.
Print Error if the input is not in a valid range.
Sample Input :
8
Sample Output :
31
const readline = require('readline');
const inp = readline.createInterface({
input: process.stdin
});
const userInput = [];
inp.on("line", (data) => {
userInput.push(data);
});
inp.on("close", () => {
var data = userInput[0].split(" ");
var a = parseInt(data[0]);
if(a==2)
console.log("28")
else if(a==1||a==3||a==5||a==7||a==8||a==10||a==12)
console.log("31")
else if (a==2||a==4||a==6||a==9||a==11)
console.log("30")
else if(a<1||a>12)
console.log("Error")
});
Comments
Post a Comment