/**
* This Java program to print all prime numbers between 1 and 100.
*/
class prime1To100
{
public static void main()
{
int i,k,j;
for(i=1;i<100;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
//https://mayanksworkshop.wordpress.com
No comments:
Post a Comment