Horje
how to check prime number in shell script Code Example
how to check prime number in shell script
#!/bin/bash
echo -e "Enter Number : \c"
read n
for((i=2; i<=$n/2; i++))
do
  ans=$(( n%i ))
  if [ $ans -eq 0 ]
  then
    echo "$n is not a prime number."
    exit 0
  fi
done
echo "$n is a prime number."




Shell

Related
bash add text to file Code Example bash add text to file Code Example
install pyramid Code Example install pyramid Code Example
how to check laravel installer version Code Example how to check laravel installer version Code Example
powershell to string Code Example powershell to string Code Example
virtualbox homebrew Code Example virtualbox homebrew Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
13