Qbasic program to find whether a number is odd or even
CLS
INPUT “ENTER ANY NUMBER”; N
IF N MOD 2 = 0 THEN
PRINT N; “IS EVEN NUMBER”
ELSE
PRINT N; “IS ODD NUMBER”
END IF
END
USING SUB
DECLARE SUB ODDEVEN(N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL ODDEVEN(N)
END
SUB ODDEVEN(N)
IF N MOD 2 = 0 THEN
PRINT N; “IS EVEN NUMBER”
ELSE
PRINT N; “IS ODD NUMBER”
END IF
END SUB
0 Comments