Write a shell script to check whether a number is Armstrong number or not?
Answer / 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 |
What is the difference between a variable and value?
What is the use of "$?" Sign in shell script?
I want to upload a file to remote server through ftp daily.Can anyone suggest how to make a shell script for that.I hv credentials for that ftp
What can scripts do?
What are the different types of shell scripting?
How do you create a shortcut in linux?
Explain about the exit command?
What command needs to be used to take the backup?
What is shell company all about?
Is shell scripting useful?
What is the difference between scripting and coding?
what is the difference between sh & bash shell?