QBASIC PROGRAM TO CALCULATE TOTAL NO. OF DIGITS

QBASIC PROGRAM TO COUNT TOTAL NO. OF DIGITS



 CLS
 INPUT "ENTER ANY NUMBER"; N
 C = 0
 WHILE N < > 0
 C = C + 1
 N = N \ 10
 WEND
 PRINT "TOTAL NUMBER OF DIGITS"; C
 END

USING SUB


DECLARE SUB DIGITS(N)
 CLS
 INPUT "ENTER ANY NUMBER"; N
 CALL DIGITS(N)
 END
 
 SUB DIGITS(N)
 C = 0
 WHILE N < > 0
 C = C + 1
 N = N \ 10
 WEND
 PRINT "TOTAL NUMBER OF DIGITS"; C
 END SUB

Post a Comment

0 Comments