(C PROGRAMMING ONLY) 1. Leap Year Detector by CodeChum Admin Let’s try to find out whether a year has 365 or 366 days. To do this, we need to create a leap year detector! Conditions for a leap year: 1.) year must be divisible by 4 and not divisible by 100 2.) If year is divisible by 100, it must be divisible by 400 for it to be a leap year. Instructions: You are provided with the isLeapYear() function which is already declared and defined for you. Your task is to ask the user for a year and then call the isLeapYear function to check whether the year is a leap year or not. Input 1. Year to be checked Output If a certain year is a leap year, print " is a leap year" Otherwise, print " is not a leap year" Enter year: 2020 2020 is a leap year
(C PROGRAMMING ONLY)
1. Leap Year Detector
by CodeChum Admin
Let’s try to find out whether a year has 365 or 366 days. To do this, we need to create a leap year detector!
Conditions for a leap year:
1.) year must be divisible by 4 and not divisible by 100
2.) If year is divisible by 100, it must be divisible by 400 for it to be a leap year.
Instructions:
You are provided with the isLeapYear() function which is already declared and defined for you.
Your task is to ask the user for a year and then call the isLeapYear function to check whether the year is a leap year or not.
Input
1. Year to be checked
Output
If a certain year is a leap year, print "<INSERT_YEAR_HERE> is a leap year"
Otherwise, print "<INSERT_YEAR_HERE> is not a leap year"
Enter year: 2020
2020 is a leap year
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 4 images