answersLogoWhite

0


Best Answer

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

12y ago
This answer is:
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
Related questions

Write a shell script to check whether the given input is prime or not?

shell script for check whether the given no is prime or not??echo "input any number:"read nono=`expr $no`i=`expr 2`while [ $i -lt $no ]doif [ `expr $no % $i` -eq 0];thenecho "$no is not a prime no.."break 2fii=`expr $i +1`doneif [ $i -eq $no ];thenecho "$no is a PRIME no..."fi


Are 83 43 and 61 prime?

The given three numbers are all prime numbers


When you write a number as a product of prime numbers?

A number as a product of prime numbers would be "x".


Are 809 67 41 5 23 prime numbers?

Yes, all of the given numbers are prime numbers.


What is it called when all the prime numbers that make a given number called?

i think prime numbers


How can find prime numbers using do while in java script?

//some students also asked it with alert dialog box ! I have done it in a HTML page 100% working best of Luck !_Z triplezero here :) <script type="text/javascript"> var inum, icount=2; var irem; inum = prompt("Enter a number."); if(inum==1) { alert("The no. is not prime"); document.write("The no. is not prime"); exit(0); } if(inum==2) { alert("The no. is prime"); document.write("The no. is prime"); exit(0); } do { irem=inum%icount; if(irem==0) { alert("The no. is not prime"); document.write("the given no is not prime"); exit(0); } icount++; } while(icount<=(inum/2)); alert("The no. is prime"); document.write("the given number is prime"); </script>


What are the sum of the prime numbers 15 and 35?

The given numbers of 15 and 35 are not prime numbers but they add up to 50


What numbers is a prime number 106 121 168 211?

211 is the only of the given numbers that is prime.


What are the prime factors between 20 and 30?

Prime numbers between the given numbers are 23 and 29


Are there prime numbers over 100?

Sure, since there are INFINITELY MANY prime numbers, that means you will find prime numbers over any given number.


What to write when describing the properties of prime numbers?

Numbers divisible by 1 & number itself are called prime numbers. These numbers also have the property to be odd numbers.


What name is given to prime numbers that you can reverse to make another prime number?

A mirror prime.