QBasic Programming

WAP to input any number and check whether the given no. is divisible by 3 and 7 or not

REM
CLS
INPUT “ENTER ANY NUMBER”; N
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
PRINT N; "IS COMPLETELY DIVISIBLE BY 3 AND 7”
ELSE
PRINT N; "IS NOT COMPLETELY DIVISIBLE BY 3 AND 7”
END IF
END
USING SUB PROCEDURE
DECLARE SUB CHECK (N)
CLS
INPUT “ENTER ANY NUMBER”; N
CALL CHECK (N)
END
SUB CHECK (N)
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
PRINT N; "IS COMPLETELY DIVISIBLE BY 3 AND 7”
ELSE
PRINT N; "IS NOT COMPLETELY DIVISIBLE BY 3 AND 7”
END IF
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION CHECK$ (N)
CLS
INPUT “ENTER ANY NUMBER”; N
PRINT N; “IS “; CHECK$(N) ; “BY 3 AND 7”
END
FUNCTION CHECK$ (N)
IF N MOD 3 = 0 AND N MOD 7 = 0 THEN
CHECK$ = “DIVISIBLE”
ELSE
CHECK$ = “NOT DIVISIBLE”
END IF : END FUNCTION

WAP to input any number and check whether the given no. is divisible by 5 or not (Prev Lesson)
(Next Lesson) WAP to input any number and check whether the given no. is positive, negative or zero
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!