Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo "-------------------------------"
- echo "Check Number is Prime Or Not"
- echo "-------------------------------"
- echo -n "Enter the Number : "
- read no
- i=2
- f=0
- while [ $i -le `expr $no / 2` ]
- do
- if [ `expr $no % $i` -eq 0 ]
- then
- f=1
- fi
- i=`expr $i + 1`
- done
- if [ $f -eq 1 ]
- then
- echo "-------------------------------"
- echo "$no is Not Prime Number"
- echo "-------------------------------"
- else
- echo "-------------------------------"
- echo "$no is Prime Number"
- echo "-------------------------------"
- fi
Add Comment
Please, Sign In to add comment