/**

* This Java program to print all prime numbers between 1 and 1000.

*/

class prime1To1000

{

public static void main()

{

int i,k,j;

for(i=1;i<1000;i++)

{

k=0;

for(j=2;j<i;j++)

{

if(i%j==0)

{

k=1;

break;

}

}

if(k==0)

{

System.out.println(i);

}

}

}

}

//Author : Mayank Rajoria

* This Java program to print all prime numbers between 1 and 1000.

*/

class prime1To1000

{

public static void main()

{

int i,k,j;

for(i=1;i<1000;i++)

{

k=0;

for(j=2;j<i;j++)

{

if(i%j==0)

{

k=1;

break;

}

}

if(k==0)

{

System.out.println(i);

}

}

}

}

//Author : Mayank Rajoria

## No comments:

## Post a Comment