QBasic Programming

Enter any two numbers and display its product

REM PROGRAM TO DISPLAY PRODUCT OF TWO NUMBERS
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
P = A * B
PRINT “PRODUCT OF TWO NUMBERS”; P
END

USING SUB PROCEDURE

DECLARE SUB PROD (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
CALL PROD(A, B)
END

SUB PROD (A, B)
P = A * B
PRINT “PRODUCT OF TWO NUMBERS”; P
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PROD (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
PR = PROD(A, B)
PRINT “PRODUCT OF TWO NUMBERS”; PR
END

FUNCTION PROD (A, B)
P = A * B
PROD = P
END FUNCTION

Enter any two numbers and display its difference (Prev Lesson)
(Next Lesson) Enter any two numbers and display its average
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!