Information Technology IT – 4 Algorithms and flowcharts | e-Consult
4 Algorithms and flowcharts (1 questions)
Login to see all questions.
Click on a question to view the answer
Algorithm:
- Start
- Get the year as input (let's call it
year). - If
yearis divisible by 4 andyearis not divisible by 100 then:- Output: True (It's a leap year)
- Else If
yearis divisible by 400 then:- Output: True (It's a leap year)
- Else:
- Output: False (It's not a leap year)
- End
Pseudocode:
START
INPUT year
IF year MOD 4 = 0 AND year MOD 100 != 0 THEN
OUTPUT True
ELSE IF year MOD 400 = 0 THEN
OUTPUT True
ELSE
OUTPUT False
ENDIF
END