. Identify Leap Years Years that are evenly divisible by 100 are not leap years,
ID: 3527542 • Letter: #
Question
. Identify Leap Years Years that are evenly divisible by 100 are not leap years, unless they are also evenly divisible by 400, in which case they are leap years. For example, 1600 and 2000 were leap years, but 1700, 1800 and 1900 were not. Similarly, 2100, 2200, 2300, 2500, 2600, 2700, 2900 and 3000 will not be leap years, but 2400 and 2800 will be. Description: Write a program that will identify if a year is a proper Leap Year. 1. Declare a variable that will store the year. 2. Prompt the user for the year. 3. Read in the value entered by the user. 4. Determined if the year divisible by 400 ? If the year is divisible by 400, output:Explanation / Answer
all leap years are divisible by 4. lemme think...ok so round the lower year up to the closest # number divisible by 4, and round the higher # down. so 1944 and 1964. 1964-1944=20, 20/4=5, and there's your answer. Find the difference and divide by 4 (you are finding the number of years that could possibly contain a leap year and as every 4 years is a leap year, you divide by 4, you just have to start and end on leap years). oops round both either up or down. One more thing:if one of the years IS a leap year, you have to round up for the other one. So you inlude everything (you need the higher up endpoint). Don't listen to the other guys: you have to round. For example, what if you were asked to find the leap years between 1960 and 1970. The difference is 10. Not evenly divisibly by 4. There are 3 leap years in that time span and you would know that if you rounded 1970 to 1972 and divided the diff (12) by 3.. 1960,64,&68 are the leap years. or jeap yrs occur every 4 yrs & its divisible by 4 between 1941 &1961, its 20yrs so 20/4=5 leap yrs between 1941 &1961
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.