QBASIC PROGRAM TO FIND SUM OF CUBE OF EVEN DIGITS OF A NUMBER

QBASIC PROGRAM TO FIND SUM OF CUBE OF EVEN DIGITS OF A NUMBER



 CLS
 INPUT "ENTER ANY NUMBER"; N
 S = 0
 WHILE N < > 0
 R = N MOD 10
 IF R MOD 2 = 0 THEN S = S + R ^ 3
 N = N \ 10
 WEND
 PRINT "SUM OF CUBE OF EVEN DIGITS"; S
 END

USING SUB


DECLARE SUB CUBEEVEN(N)
 CLS
 INPUT "ENTER ANY NUMBER"; N
 CALL CUBEEVEN(N)
 END
 
 SUB CUBEEVEN(N)
 S = 0
 WHILE N < > 0
 R = N MOD 10
 IF R MOD 2 = 0 THEN S = S + R ^ 3
 N = N \ 10
 WEND
 PRINT "SUM OF CUBE OF EVEN DIGITS"; S
 END SUB

Post a Comment

0 Comments