QBasic Programming

To divide a number by another number and find the quotient and remainder

NUMBER"; A
INPUT "ENTER SECOND NUMBER"; B
CALL DIVIDE (A, B)
END CLS
INPUT "ENTER FIRST NUMBER"; A
INPUT "ENTER SECOND NUMBER"; B
IF A > B THEN
R = A MOD B
Q = A \ B
ELSE
R = B MOD A
Q = B \ A
END IF
PRINT "QUOTIENT="; Q
PRINT "REMAINDER ="; R
END
USING SUB PROCEDURE

DECLARE SUB DIVIDE (A, B)
CLS
INPUT "ENTER FIRST

SUB DIVIDE (A, B)
IF A > B THEN
R = A MOD B
Q = A \ B
ELSE
R = B MOD A
Q = B \ A
END IF
PRINT "QUOTIENT="; Q
PRINT "REMAINDER ="; R
END SUB

WAP to input any number and display whether it is odd or even (Prev Lesson)
(Next Lesson) WAP to input any number and check whether the given no. is positive or negative
Back to QBasic Programming

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!