QBASIC Program To Find The Greatest Among Three Numbers

 QBASIC Program To Find The Greatest Among Three Numbers

QBASIC Program To Find The Greatest Among Three Numbers


QBASIC Program To Find The Greatest Among Three Numbers


CLS
INPUT" Enter the first number"; A
INPUT" Enter the second number"; B
INPUT" Enter the third number"; C
IF A>B AND A>C THEN
PRINT" The greatest number is "; A
ELSEIF B>A  AND  B> C THEN
PRINT" The greatest number is "; B
ELSE
PRINT" The greatest number is "; C 
END IF
END


QBASIC Program To Find The Greatest Among Three Numbers Using SUB Procedure

DECLARE SUB GREATEST(A, B, C)
CLS
INPUT" Enter the first number"; A
INPUT" Enter the second number"; B
INPUT" Enter the third number"; C
CALL GREATEST(A, B, C)
END
SUB GREATEST(A, B, C)
IF A>B AND A>C THEN
PRINT" The greatest number is "; A
ELSEIF B>A  AND  B> C THEN
PRINT" The greatest number is "; B
ELSE
PRINT" The greatest number is "; C 
END IF
END SUB

QBASIC Program To Find The Greatest Among Three Numbers Using SUB Procedure

DECLARE FUNCTION GREATEST(A, B, C)
CLS
INPUT" Enter the first number"; A
INPUT" Enter the second number"; B
INPUT" Enter the third number"; C
PRINT " The greatest number is"; GREATEST(A, B, C)
END
FUNCTION GREATEST(A, B, C)
IF A>B AND A>C THEN
GREATEST=A
ELSEIF B>A  AND  B> C THEN
GREATEST= B
ELSE
GREATEST=C 
END IF
END FUNCTION

Comments