WAP to find whether a number is odd or even

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

Post a Comment

0 Comments