Create pseudocode that checks if the year is a leap one and stores the result in the isLeap variable. As you know, leap years are divisible by 4. However, there is an exception to this rule: centuries that are not divisible by 400 are not leap years (for example, 1900 wasn't a leap year).
Computer scienceAlgorithms and Data StructuresIntro to algorithms and data structuresPseudocode and representation
Relations and conditions in pseudocode
Leap year
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
if year mod 400 != 0 and year mod 100 == 0 then:
else:
isLeap = false
isLeap = false
isLeap = true
elif year mod 4 == 0 then:
year = 2000
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.