top of page

Write c shell script to check the no is prime or not

  • Jan 8, 2018
  • 1 min read

Updated: Mar 18, 2021


c shell shell script to check the no is prime or not

@ i= 2
echo "\n enter the no to check prime"
@ n = $<
 
while ( $i < $n )
            if ( $n % $i == 0 ) then
                        @ f = 0
                                    break
            else
                        @ f = 1
endif
            @ i++
end
if ( $f == 1 ) then
            echo "the given no. is prime"
else
echo "not a prime no."
endif




 
 
 

Comments


bottom of page