public class yps
{
public static void main(String args[])
{
int p[]=new int[10]; //to store 10 prime numbers
int num, i=0,j, count=0,c=0,a;
for(num=2; num<100; num++)
{
for(j=1; j<=num; j++)
{
if(num%j==0)
{
c++;
}
}
if(c==2)
{
p[i]=num;
i++;
count++;
}
if(count==10)
{
break;
}
c=0;
}
System.out.println("First 10 Prime nums are: ");
for(a=0;a<10;a++)
{
System.out.println(p[a]);
}
}
}
{
public static void main(String args[])
{
int p[]=new int[10]; //to store 10 prime numbers
int num, i=0,j, count=0,c=0,a;
for(num=2; num<100; num++)
{
for(j=1; j<=num; j++)
{
if(num%j==0)
{
c++;
}
}
if(c==2)
{
p[i]=num;
i++;
count++;
}
if(count==10)
{
break;
}
c=0;
}
System.out.println("First 10 Prime nums are: ");
for(a=0;a<10;a++)
{
System.out.println(p[a]);
}
}
}