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.

Check Also

Program to check Upper Triangular matrix

What is Upper Triangular Matrix?  An upper triangular matrix is a square matrix in which ...

Leave a Reply

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

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.