Wednesday, October 16, 2019

38. Qbasic Program to input days and convert into years, months and days


38.      Write a program to input days and convert into years, months and days using sub procedure.

DECLARE SUB CONVERT(D)
CLS
INPUT “ENTER DAYS”; D
CALL CONVERT(D)
END
SUB CONVERT (D)
Y = D \ 365
MO = D MOD 365
M = MO \ 30
D = MO MOD 30
PRINT Y; “YEARS ” ; M; “MONTHS”; D; “DAYS”
END SUB


1 comment: