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

QBASIC PROGRAM TO FIND SUM OF SQUARE 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 ^ 2
 N = N \ 10
 WEND
 PRINT "SUM OF SQUARE OF EVEN DIGITS"; S
 END

USING SUB


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

Post a Comment

0 Comments