Wednesday, October 16, 2019

49. Qbasic program to input a year and display whether that year is a leap year or not

49.      Write a program to input a year and display whether that year is a leap year or not. [divisible by 4 but not 100] using sub procedure.

DECLARE SUB CHECK (Y)
CLS
INPUT “ENTER YEAR”; Y
CALL CHECK (Y)
END
SUB CHECK (Y)
IF Y MOD 4 = 0 AND Y MOD 100 <> 0 OR Y MOD 400 = 0 THEN
PRINT “LEAP YEAR”
ELSE
PRINT “NOT LEAP YEAR”
END IF
END SUB

No comments:

Post a Comment