postheadericon Write a shell script to Accept number and check the number is even or odd, finds the length of the number, sum of the digits in the number.


clear
echo "Enter Number : "
read no

count=0
total=0


if [ `expr $no % 2` -eq 0 ]
then
echo "NUMBER IS EVEN"
else
echo "NUMBER IS ODD"
fi

while [ $no -ne 0 ]
do
a=`expr $no % 10`
no=`expr $no / 10`
total=`expr $total + $a`
count=`expr $count + 1`
done


echo "Sum of All Digit : $total"
echo "Total No. of Digit : $count"

2 comments:

Unknown said...

There are lots of information about latest technology and how to get trained in them, like UNIX Training in Chennai have spread around the web, but this is a unique one according to me. The strategy you have updated here will make me to get trained in future technologies(UNIX Training Centers in Chennai). By the way you are running a great blog. Thanks for sharing this.

UNIX Training Centers in Chennai | UNIX Course Chennai

Unknown said...

Thanks for sharing this valuable post.
Regards,
Unix Training in Chennai | Unix course in Chennai | Unix Training institutes in Chennai

Follow by Email

Total Pageviews

© BipinRupadiya.com. Powered by Blogger.