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 are the four fundamental components of every file system on linux?
Can you write a script to portray how set –x works?
What is Path variable?What is its use?
How to find all the files modified in less than 3 days and save the record in a text file?
What is path in shell script?
What does sh mean?
How to open a read-only file in the shell?
How to group the commands in shell scripting?
What is the command for " how many shell is running in your system or how many shell supported by your system " ?.
What is scripting autism?
What is the equivalent of a file shortcut that we have a window on a linux system?
What are the different kinds of loops available in shell script?