Monday , December 18 2017
Home / Blue J / Java program for producing prime numbers for given range

Java program for producing prime numbers for given range

Program to print all prime numbers between 100 to 10000 or whatever given range.
 

class prime
{
public static void main()
{
int i,j,k;
for(i=101;i<10000l;i++) //here you can give your own range
{
         k=0;
         for(j=2;j<i;j++)
         {
                  if(i%j==0)
                  k++;
         }
         if(k==0)
         System.out.print(i+"   ");
}
}
}


OUTPUT:

Tags: bluej program to find the prime numbers between 100 to 1000, prime numbers for a given range.

Also See:   JAVA program to check Anagram of a Words

Check Also

Java program to implement polymorphism

Java program to implement polymorphism: Polymorphism is a technique in java with which you can ...

Leave a Reply

Your email address will not be published. Required fields are marked *