Facebook
From Big Echidna, 1 Year ago, written in Plain Text.
This paste is a reply to Re: https://pastebin.pl/view/24480661 from rifaT - view diff
Embed
Download Paste or View Raw
Hits: 321
  1. function prime()
  2. {
  3.     for((i=2; i<=num; i++))
  4.     do
  5.         if [ `expr $num % $i` == 0 ]
  6.         then
  7.             echo $num is not prime
  8.             exit
  9.         fi
  10.     done
  11.     echo $num is a prime number
  12. }
  13.  
  14. read num;
  15. prime "$num";