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 "c" and "b" permission fields of a file?
How do I start a shell script?
How to customise the existing shell?
How to open a read-only file in the shell?
How u convert string "hi pravin how are you?" to "Hi Pravin How Are You?"
In a file , how to retrieve the lines which are the multiples of 50 ? like 50,100,150th lines etc.
What is wc in shell script?
How to check if a directory exists?
how do you write sql queries using shell script for eg:- we have databae table like EMPNO,ENAME,SAL,DEPTNO columns in EMP table how you display EMPNO,SAL FIELDS from emp in SHELL SCRIPT please explain with an example
What is $1 in shell scripting?
how will you find the total disk space used by a specific user?
Write a shell script to looking at the log file to see if the test has passed or not