write a program to print all prime numbers 1-100
Answers
Answered by
2
Answer:public class Prime
{
public static void main(String[] args)
{
int ct=0,n=0,i=1,j=1;
while(n<25)
{
j=1;
ct=0;
while(j<=i)
{
if(i%j==0)
ct++;
j++;
}
if(ct==2)
{
System.out.printf("%d ",i);
n++;
}
i++;
}
}
}
Similar questions