class PrimeNo
{
public static void main(String[] args)
{
int i, n = 1, count;
System.out.println("Prime Number Between 1 to 100");
while(n <= 100)
{
count = 0;
i = 2;
while(i <= n/2)
{
if(n%i == 0)
{
count++;
break;
}
i++;
}
if(count == 0 && n != 1 )
{
System.out.println(" "+ n);
}
n++;
}
}
}
No comments:
Post a Comment