Wednesday, October 16, 2019

39. Qbasic Program to input seconds and convert into hours minutes and seconds


39.      Write a program to input seconds and convert into hours minutes and seconds using sub procedure.

DECLARE SUB CONVERT(S)
CLS
INPUT “ENTER TIME IN SECONDS”; S
CALL CONVERT(S)
END
SUB CONVERT (S)
H = S \ 3600
MI = S MOD 3600
M = MI \ 60
S = MI MOD 60
PRINT H; “HOURS”; M; “MINUTES”;  S; “SECONDS”
END SUB

1 comment: