Program to find greatest among 3 numbers using SUB
DECLARE SUB GREAT(A,B,C)
CLS
INPUT"ENTER FIRST NUMBER";A
INPUT"ENTER SECOND NUMBER";B
INPUT"ENTER THIRD NUMBER";C
CALL GREAT(A,B,C)
SUB
SUB GREAT(A,B,C)
IF A>B AND A>C THEN
PRINT"GREATEST NUMBER IS";A
ELSEIF B>A AND B>C THEN
PRINT"GREATEST NUMBER IS";B
ELSE
PRINT"GREATEST NUMBER IS";C
END IF
END SUB
CLS
INPUT"ENTER FIRST NUMBER";A
INPUT"ENTER SECOND NUMBER";B
INPUT"ENTER THIRD NUMBER";C
CALL GREAT(A,B,C)
SUB
SUB GREAT(A,B,C)
IF A>B AND A>C THEN
PRINT"GREATEST NUMBER IS";A
ELSEIF B>A AND B>C THEN
PRINT"GREATEST NUMBER IS";B
ELSE
PRINT"GREATEST NUMBER IS";C
END IF
END SUB
Comments
Post a Comment