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 shift command in shell script?
Is shell scripting difficult?
How will I insert a line "abcdef" at every 100th line of a file?
What is the difference between a shell variable that is exported and the one that is not exported?
Can shell script run on windows?
How to open a read-only file in the shell?
Please anyone suggest atleast 2 good training institutes in Hyderabad, INDIA where i can learn unix shell scripting.
What are the two files of crontab command?
What are the 4 basics of OOP?
When you login to a c shell, which script would be run first?
How to initialize a directory size to a variable??
How do I save a powershell script?