What does the flowchart look like?
Ready to draw?
No signup. Opens instantly in your browser.
What is the matching code?
Pseudocode
read year
if year is divisible by 400 then leap
else if year is divisible by 100 then not leap
else if year is divisible by 4 then leap
else not leapPython
def is_leap(year):
if year % 400 == 0:
return True
if year % 100 == 0:
return False
return year % 4 == 0C
int is_leap(int year) {
if (year % 400 == 0) return 1;
if (year % 100 == 0) return 0;
return year % 4 == 0;
}- 2000 is a leap year because 400 divides it. 1900 is not, because 100 divides it and 400 does not.
- 2024 is a leap year. 2023 is not.