QBasic Programming

Input seconds and convert into hours minutes and seconds

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

Input days and convert into years, months and days (Prev Lesson)
(Next Lesson) Input distance in kilometer and convert into meter
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!