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 |
How to write an Auto scripting for deleting old files using shell script and made a cron job to run on daily basis
What are the different commands available to check the disk usage?
Write a shell script to check whether a number is Armstrong number or not?
How to print the first array element?
How to get the last line from a file using just the terminal?
How will you connect to a database server from linux?
Is powershell a bash?
What is the significance of $#?
what are bootlevel in linux?which level is booting by default.
What is the command for " how many shell is running in your system or how many shell supported by your system " ?.
Hi, all Scripting professional. Q. I have written script1.sh and calling script2.sh in script1.sh file using bash shell as interpreter and my log in shell also bash shell.My code like Script1 #!/bin/bash echo "My script2 call" . script2.sh Here script2.sh file run successfully but when I have changed my interpreter bash to ksh like #!/bin/ksh Error are comming script2.sh command not found. Guid me how to call other script in our main script.
State the advantages of shell scripting?