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 |
A file has multiple records each having three 30-bit long fields(field1,field2,field3).There is also a lookup file,LOOK_UP.dat.Now, we need to consider only the last ten digits of field1 and lookup the file LOOK_UP.dat. If there a match then field2 and field3 should replaced with corresponding data from the lookup file. otherwise that particular record,for which there is no match, should be stored in a seperate file.
What is the first line in every perl script called?
what are command line arguments? what is the need of those?
What does echo mean in scripting?
What is inside a seashell?
What is .sh file in mac?
What is computer cli?
What does the sh command do?
How to print the first array element?
what is the difference between writing code in shell and editor?
How important is shell scripting?
What is difference between bash and shell?