Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Q basic programs

DECLARE SUB CHECK(N)


CLS
INPUT “Enter any number”; N
CALL CHECK(N)
END
SUB CHECK(N)
IF N > 0 THEN
PRINT N; “It is a positive number”
ELSEIF N < 0 THEN
PRINT N; “It is a negative number”
ELSE
PRINT N; “The number is Zero”
END IF
END SUB

Using FUNCTION Procedure:

DECLARE FUNCTION CHECK$(N)


CLS
INPUT “Enter any number”; N
PRINT N; “IS “; CHECK$(N)
END
FUNCTION CHECK$(N)
IF N > 0 THEN
CHECK$ = “It is a positive number”
ELSEIF N < 0 THEN
CHECK$ = “It is a negative number”
ELSE
CHECK$ = “The number is Zero”
END IF
END FUNCTION

You might also like