I have a problem in writing a code on javascript I should use an if statement to verify whether a year is leap or not and this is what I came up with:
if (year % 4 == 0 && year % 100 == 0 && year % 400 == 0 || year % 4 == 0 && year % 100 != 0)
{
document.write("<p>It is a leap year</p>");
}
Now I have to create a calculator with two variables x1, x2, assign them values and then perform an operation on them in an else if statement. Also, should I put a variable number for the year in the first if statement?
I know that it should be easy to do but I'm getting really confused.
Thank you.
Aucun commentaire:
Enregistrer un commentaire