QBASIC PROGRAM TO FIND SMALLEST NUMBER

QBASIC PROGRAM TO FIND SMALLEST NUMBER AMONG THREE USER INPUT NUMBERS



 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


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
 PRINT A; “IS SMALLEST”
 ELSEIF B < A AND B < C THEN
 PRINT B; “IS SMALLEST”
 ELSE
 PRINT C; “IS SMALLEST”
 END IF
 END SUB

Post a Comment

0 Comments