Virajsinh

Check_Prime_OS_Script

Sep 14th, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. echo "-------------------------------"
  2. echo "Check Number is Prime Or Not"
  3. echo "-------------------------------"
  4.  
  5. echo -n "Enter the Number : "
  6. read no
  7. i=2
  8. f=0
  9. while [ $i -le `expr $no / 2` ]
  10. do
  11. if [ `expr $no % $i` -eq 0 ]
  12. then
  13. f=1
  14. fi
  15. i=`expr $i + 1`
  16. done
  17. if [ $f -eq 1 ]
  18. then
  19. echo "-------------------------------"
  20. echo "$no is Not Prime Number"
  21. echo "-------------------------------"
  22. else
  23. echo "-------------------------------"
  24. echo "$no is Prime Number"
  25. echo "-------------------------------"
  26. fi
Add Comment
Please, Sign In to add comment