Wednesday, October 16, 2019

50. Qbasic rogram to input any number and display whether it is odd or even

50.      Write a program to input any number and display whether it is odd or even using function procedure.

DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT “THE GIVEN NUMBER IS “; CHECK$(N)
END

FUNCTION CHECK$ (N)
IF N MOD 2 = 0 THEN
CHECK$ = “EVEN NUMBER”
ELSE
CHECK$ = “ODD NUMBER”
END IF
END FUNCTION

No comments:

Post a Comment