2. Enter any two numbers and display its difference.
REM PROGRAM TO DISPLAY DIFFERENCE OF
TWO NUMBERS
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
D = A - B
PRINT “DIFFERENCE OF TWO NUMBERS”; D
END
USING SUB PROCEDURE
DECLARE SUB DIFF (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
CALL DIFF(A, B)
END
SUB DIFF (A, B)
D = A - B
PRINT “DIFFERENCE OF TWO NUMBERS”; D
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION DIFF (A, B)
CLS
INPUT “ENTER FIRST NUMBER”; A
INPUT “ENTER SECOND NUMBER”; B
DI = DIFF(A, B)
PRINT “DIFFERENCE OF TWO NUMBERS”;
DI
END
FUNCTION DIFF (A, B)
D = A - B
DIFF = D
END FUNCTION
No comments:
Post a Comment