public class as1a{
public static void main(String[] args)
{
int i,j,r;
r=Integer.parseInt(args[0]);
for(i=2;i<=r;i++)
{
for(j=2;j<=i;j++)
{
if(i%j==0)
break;
}
if(i==j)
System.out.print(" " +i + " ");
}
}
}
/*Output:java as1a 25
2 3 5 7 11 13 17 19 23*/
0 comments:
Post a Comment