QBasic Programming

Input value in kilogram and convert into grams

REM PROGRAM TO CONVERT VALUE IN KILOGRAM TO GRAMS
CLS
INPUT”ENTER VALUE IN KILOGRAM”; K
G = K * 1000
PRINT “VALUE IN GRAMS=”; G
END

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

SUB CONVERT (K)
G = K * 1000
PRINT “VALUE IN GRAMS=”; G
END SUB

USING FUNCTION PROCEDURE
DECLARE FUNCTION CONVERT(K)
CLS
INPUT”ENTER VALUE IN KILOGRAM”; K
PRINT “VALUE IN GRAMS=”; CONVERT(K)
END

FUNCTION CONVERT (K)
G = K * 1000
CONVERT = G
END FUNCTION

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

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!