1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/bin/bash # Shell program to calculate the number of digits in a # number read from the user # ----------------------------------------------- # Copyright (c) 2005 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- echo -n "Enter number : " read n sd=0 # store number of digit nd=0 on=$n # store $n so that we can use it later # use while loop to caclulate the number of digit while [ $n -gt 0 ] do sd=$(( $n % 10 )) # get Remainder n=$(( $n / 10 )) nd=$(( $nd + 1)) # calculate all digit in a number till n is not zero done echo "Numnber of digit in a $on is $nd" |

what the mean $(( $n / 10 )) or $(( $n % 10 ))???

hi,pls.answer

what will you get if you add 2 odds numbers and an even number?

What if n is zero?

Hi,

num=

`printf "%d" 42`

&& echo ${#num}can u pls say a Source code for sum of two no’s