Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Write a shell script to check whether a number is Armstrong number or not?

Answer Posted / kirtiranjan sahoo

read -p "Enter any number : " no
rev=0
temp=$no
while [ $no -ne 0 ]
do
dig=$(( $no%10 ))
rev=$(( $rev+$dig*$dig*$dig ))
no=$(( $no/10 ))
done
if [ $rev -eq $temp ]
then
echo "Armstrong"
else
echo "Not Armstrong"
fi

Is This Answer Correct ?    26 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of "$?" Sign in shell script?

1129


What is $1 in shell scripting?

1002


I want to create a directory such that anyone in the group can create a file and access any person's file in it but none should be able to delete a file other than the one created by himself.

995


What is shell chemistry?

938


Explain about the slow execution speed of shells?

1186


What is meant by $1 in shell script?

925


How to set an array in linux?

1160


How to print pid of the current shell?

963


how to print the matrix form of 2-d, 3-d arrays in unix c shell scripts ?

4041


What is the syntax of while loop in shell scripting?

998


Explain about the exit command?

946


write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?

4081


What are the types of script?

1121


What does $$ mean in shell script?

1013


how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

2541