QBasic Programming

WAP to input number and find product of digits

REM
CLS
INPUT "ENTER ANY NUMBER"; N
P = 1
WHILE N < > 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PRINT "PRODUCT OF DIGITS"; P
END

USING SUB PROCEDURE

DECLARE SUB PROD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL PROD (N)
END

SUB PROD (N)
P = 1
WHILE N < > 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PRINT "PRODUCT OF DIGITS"; P
END SUB

USING FUNCTION PROCEDURE

DECLARE FUNCTION PROD (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PR = PROD (N)
PRINT "PRODUCT OF DIGITS"; PR
END

FUNCTION PROD (N)
P = 1
WHILE N < > 0
R = N MOD 10
P = P * R
N = N \ 10
WEND
PROD = P
END FUNCTION

WAP TO DISPLAY L.C.M OF A GIVEN ANY TWO NUMBERS (Prev Lesson)
(Next Lesson) WAP to input number and find product of odd digits
Back to QBasic Programming
Notice: compact(): Undefined variable: limits in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

Notice: compact(): Undefined variable: groupby in /home/bhimgautam34/public_html/wp-includes/class-wp-comment-query.php on line 853

No Comments

Post a Reply

Course Curriculum

error: Content is protected !!