QBasic Programming

WAP to enter any three numbers and display the smallest one

CLS
INPUT “ENTER ANY THREE NUMBERS”; A, B, C
IF A < B AND A < C THEN
PRINT A; “IS SMALLEST”
ELSEIF B < A AND B < C THEN
PRINT B; “IS SMALLEST”
ELSE
PRINT C; “IS SMALLEST”
END IF : END
USING SUB PROCEDURE
DECLARE SUB SMALL(A, B, C)
CLS
INPUT “ENTER ANY THREE NUMBERS”; A, B, C
CALL SMALL (A, B, C)
END
SUB SMALL (A, B, C)
IF A < B AND A < C THEN
S = A
ELSEIF B < A AND B < C THEN
S = B
ELSE
S = C
END IF
PRINT “THE SMALLEST NUMBER IS “; S
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION SMALL (A, B, C)
INPUT “ENTER ANY THREE NUMBERS”; A, B, C
PRINT “THE SMALLEST NUMBER IS”; SMALL (A, B, C)
END
FUNCTION SMALL (A, B, C)
IF A < B AND A < C THEN
S = A
ELSEIF B < A AND B < C THEN
S = B
ELSE
S = C
END IF : SMALL = S
END FUNCTION

WAP to enter any three numbers and display the greatest one (Prev Lesson)
(Next Lesson) WAP to enter any three numbers and display the middle number
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!