Wednesday, October 16, 2019

64. Qbasic program to input number and count total no. of digits.


64.      Write a sub program to input number and count total no. of digits.

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

No comments:

Post a Comment