Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Here are three definitions: a. Def: A year y is a century year if y is divisible

ID: 3654849 • Letter: H

Question

Here are three definitions: a. Def: A year y is a century year if y is divisible by 100. Example: y=300 is a century year, but y=150 is not. b. Def: A year y is a non-century year if y is not a century year. Example: y=150 is a non century year. Y=4 is a non-century year. c. Def: a year y is a leap year if it is a non-century year that is divisible by 4, or a century year that is divisible by 400. Nothing else is a leap year. Example: y=4 is a leap year, y=100 is not a leap year, y=400 is a leap year. Question: a Write a function bool leapyear(int y) that when passed a year y will return true if y is a leap year and false if not.

Explanation / Answer

bool leapyear(int y) { if(y/400==0) return TRUE; else if (y/4==0 && y/100!=0) return True; else return FALSE; }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote