Code: Select all
function countDigit(n As Ulongint) As Integer
return INT(log(10(n)) + 1)
end function
Dim As Integer n
input "Enter number: ";n
print countDigit(n)
Sleep
Code: Select all
function countDigit(n As Ulongint) As Integer
return INT(log(10(n)) + 1)
end function
Dim As Integer n
input "Enter number: ";n
print countDigit(n)
Sleep
Code: Select all
function countDigit(n As Ulongint) As Integer
return INT((log(n)/log(10)) + 1)
end function
Dim As Integer n
input "Enter number: ";n
print countDigit(n)
sleep
Code: Select all
print len(str(n))
Code: Select all
#include "crt.bi"
function countDigit(n As Ulongint) As Integer
return INT(log10(n) + 1)
end function
Dim As Integer n
input "Enter number: ";n
print countDigit(n)
Sleep
Code: Select all
Dim As Ulongint number
Dim As Integer count
input "Enter a integer number: ",number
while number > 0
number /= 10
count +=1
wend
print "No. of digits is: ";count
Sleep
End