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
0 Comments