QBASIC PROGRAM TO FIND THE GREATEST NUMBER AMONG THREE NUMBERS

QBASIC PROGRAM TO FIND THE GREATEST NUMBER AMONG THREE NUMBERS



 CLS
 INPUT "ENTER ANY THREE NUMBERS"; A, B, C
 IF A > B AND A > C THEN
 PRINT A; "IS GREATEST"
 ELSEIF B > A AND B > C THEN
 PRINT B; "IS GREATEST"
 ELSE
 PRINT C; "IS GREATEST"
 END IF
 END

USING SUB


 DECLARE SUB GREAT(A,B,C)
 CLS
 INPUT "ENTER ANY THREE NUMBERS"; A, B, C
 CALL GREAT(A,B,C)
 END
 
 SUB GREAT(A,B,C)
 IF A > B AND A > C THEN
 PRINT A; "IS GREATEST"
 ELSEIF B > A AND B > C THEN
 PRINT B; "IS GREATEST"
 ELSE
 PRINT C; "IS GREATEST"
 END IF
 END SUB

Post a Comment

0 Comments