QBasic Programming

WAP to input number and count total no. of even digits

CLS
INPUT "ENTER ANY NUMBER"; N
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF EVEN DIGITS"; C
END
USING SUB PROCEDURE
DECLARE SUB COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
CALL COUNT (N)
END
SUB COUNT (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
PRINT "TOTAL NUMBER OF EVEN DIGITS"; C
END SUB
USING FUNCTION PROCEDURE
DECLARE FUNCTION COUNT (N)
CLS
INPUT "ENTER ANY NUMBER"; N
PRINT "TOTAL NUMBER OF EVEN DIGITS"; COUNT (N)
END
FUNCTION SUM (N)
C = 0
WHILE N < > 0
R = N MOD 10
IF R MOD 2 = 0 THEN C = C + 1
N = N \ 10
WEND
COUNT = C : END FUNCTION

WAP to input number and count total no. of odd digits (Prev Lesson)
(Next Lesson) WAP TO ENTER ANY DIGIT AND DISPLAY EVEN 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 !!