mardi 14 janvier 2020

Use the if-statement to determine what year the Olympics is vs the world cup on a long range of years [closed]

Im a beginner in javascript and i want to write a code with a prompt window that allows the user to write a year between 1950 - 2050. If the user writes a year before 1950 or after 2050 a text that says "invalid year" will appear.

The code has to determine if the year the user writes is a year of the olympics or the world cup in football. The olympics is every 4th year so 1950, 1954 , 1958 and so on. The world cup in football is every even year between two olympic games so 1952, 1956, 1960 and so on.

The code should say to the user if the year that they have written in to the prompt window match the olympics or the world cup and if not it should say something like "nothing specific happend that year".

Aucun commentaire:

Enregistrer un commentaire