echo "ENTER A NUMBER-"
read n
sum=0
while test $n -ne 0
do
dig=`expr $n % 10`
sum=`expr $sum + $dig`
n=`expr $n / 10`
done
echo "THE SUM OF DIGITS OF $n IS- $sum"
OUTPUT:
ENTER A NUMBER- 255
THE SUM OF DIGITS OF 255 IS-12
THE SUM OF DIGITS OF 255 IS-12
It's great to come across a blog once in a while that's not the same outdated material. Really glad that I came across your post. Keep us updated.
ReplyDeleteUnix Training in Chennai
Unix Shell Scripting Training in Chennai
Embedded System Course Chennai
Embedded Training in Chennai
LINUX Training in Chennai
LINUX Course in Chennai
Unix Training in Porur
Unix Training in OMR
Thanks for sharing this information. It is very helpful.
ReplyDeletealso, check Linux Course in Pune