QBasic Programming

Input distance in kilometer and convert into miles

REM PROGRAM TO CONVERT KILOMETER TO MILES
CLS
INPUT”ENTER DISTANCE IN KILOMETER”; K
M = K * 0.62
PRINT “DISTANCE IN MILES=”; M
END

USING SUB PROCEDURE
DECLARE SUB CONVERT(K)
CLS
INPUT”ENTER DISTANCE IN KILOMETER”; K
CALL CONVERT(K)
END

SUB CONVERT (K)
M = K * 0.62
PRINT “DISTANCE IN MILES=”; M
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CONVERT(K)
CLS
INPUT”ENTER DISTANCE IN KILOMETER”; K
PRINT “DISTANCE IN MILES=”; CONVERT(K)
END

FUNCTION CONVERT (K)
M = K * 0.62
CONVERT = M
END FUNCTION

Input distance in meter and convert into kilometer and meter (Prev Lesson)
(Next Lesson) Input value in kilogram and convert into grams
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!