Codes: part 70

import java.math.*;
public class prime{
public static void main (String[] args){
long a1,n1,d;
double b,c;
System.out.println(“2”);
for(n1=2; n1<190; n1++)
{b=Math.sqrt(n1);
c=Math.ceil(b)+1;
d=(long)c;
for(a1=2; a1<d; a1++)
{if(n1 % a1 == 0)
break;}
if(a1 == d)
System.out.println(n1);}}}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s