answersLogoWhite

0

echo enter a range

read rng

echo 2

j=3

while test $j -le $rng

do

i=2

x=`expr $j - 1`

while test $i -le $x

do

if [ `expr $j % $i` -ne 0 ]

then

i=`expr $i + 1`

else

break

fi

done

if [ $i -eq $j ]

then

echo $j

fi

j=`expr $j + 1`

done

User Avatar

Wiki User

13y ago

Still curious? Ask our experts.

Chat with our AI personalities

RossRoss
Every question is just a happy little opportunity.
Chat with Ross
JordanJordan
Looking for a career mentor? I've seen my fair share of shake-ups.
Chat with Jordan
DevinDevin
I've poured enough drinks to know that people don't always want advice—they just want to talk.
Chat with Devin
More answers

10 5 3 26 8 1 11

User Avatar

Add your answer:

Earn +20 pts
Q: Write shell script to print prime numbers in a given range?
Write your answer...
Submit
Still have questions?
magnify glass
imp