Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

shell script to enter a number and check the number is perfect number or not

# !/bin/bash
echo "Enter a number"
read no  
i=1
ans=0
for i in 1 2 3 4 5 .. no  
do
        if [[ $((no%i)) -eq 0  ]]  
        then
            ans=$((ans + i))
            
fi
i=`expr $i + 1`
done

if [ $no -eq $ans ]  
then
        echo "$no is perfect"
        else
        echo "$no is NOT perfect"
fi
Comment

PREVIOUS NEXT
Code Example
Shell :: git list files only upto 1-levels 
Shell :: openssl generate passwort terminal 
Shell :: transfer git repo from gitlab to github 
Shell :: install grafana on amazon linux 2 
Shell :: git close private repo 
Shell :: go install 
Shell :: find all cron jobs in linux 
Shell :: how to add a file in git 
Shell :: xargs ffmpeg multiples files 
Shell :: files 644 folders 755 
Shell :: appium inspector is getting 304 error 
Shell :: Install CasaOS 
Shell :: recursively replace : to _ in file names linux 
Shell :: docker exec 
Shell :: ssh with key linux 
Shell :: run ssh and immediately execute command 
Shell :: Replaces the last git commit 
Shell :: colcon build number of threads 
Shell :: ionic 4 image zoom 
Shell :: sudo show asterisks 
Shell :: docker splunk run 
Shell :: get all installed application in windiws in C# 
Shell :: download onenote on fedora 
Shell :: install lc ubuntu 
Shell :: wc - l command in linux 
Shell :: mamp mac debug logs 
Shell :: avd manger permission need root 
Shell :: -sS use nmap 
Shell :: arch jpg to png 
Shell :: nvcc issue in jetson nano 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =