QBasic Programming

WAP to enter any two numbers and display the greater one

REM
CLS
INPUT “ENTER ANY TWO NUMBERS”; A, B
IF A > B THEN
PRINT A; “IS GREATER”
ELSE
PRINT B; “IS GREATER”
END IF
END

USING SUB PROCEDURE

DECLARE SUB GREAT (A, B)
CLS
INPUT “ENTER ANY TWO NUMBERS”; A, B
CALL GREAT (A, B)
END
SUB GREAT (A, B)
IF A > B THEN
PRINT A; “IS GREATER”
ELSE
PRINT B; “IS GREATER”
END IF
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION GREAT (A, B)
INPUT “ENTER ANY TWO NUMBERS”; A, B
PRINT “THE GREATER NUMBER IS”; GREAT (A, B)
END
FUNCTION GREAT (A, B)
IF A > B THEN
GREAT = A
ELSE
GREAT = B
END IF
END FUNCTION

WAP to enter any 15 numbers and display only those numbers which are divisible by 5 and 7 (Prev Lesson)
(Next Lesson) WAP to enter any two numbers and display the smaller one
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!