REM PROGRAM TO INPUT SECONDS AND CONVERT INTO HOURS AND MINUTES AND SECONDS

CLS

INPUT “ENTER TIME IN SECONDS”; S

H = S \ 3600

MI = S MOD 3600

M = MI \ 60

S = MI MOD 60

PRINT H; “HOURS”; M; “MINUTES”; S; “SECONDS”

END

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

USING FUNCTION PROCEDURE

DECLARE FUNCTION CONVERT(S)

COMMON SHARED H, M

CLS

INPUT “ENTER TIME IN SECONDS”; S

SS = CONVERT (S)

PRINT H; “HOURS”; M; “MINUTES”; SS; “SECONDS”

END

FUNCTION CONVERT (S)

H = S \ 3600

MI = S MOD 3600

M = MI \ 60

S E= MI MOD 60

CONVERT = SE

END FUNCTION

## No Comments