是控制一行输出10个的.对了.前面用上\t了.不要也罢.呵呵~
人在江湖【走】,怎能不挨【刀】;为了能活【口】,唯有把己【超】!come on...
#include "conio.h"
#include "stdio.h"
#include "math.h"
main()
{
int a[100];
int b,c,m,i,k,j;
clrscr ();
for (b=2;b<=200;b++)
{ c=0;
for (m=1;m<=b;m++)
{
k=sqrt(m);
for (i=2;i<=k;i++)
if (m%i==0) break;
if (i>=k+1)
{
a[c]=m;
c++;
}
}
printf ("%d's prime numbers:\n",b);
for (j=0;j<c;j++)
printf ("%d ",a[j]);
printf ("\n");
}
}应该是这样做的
#include "conio.h"
#include "stdio.h"
#include "math.h"
main()
{
int a[100];
int b,c,m,i,k,j;
clrscr ();
for (b=2;b<=200;b++)
{ c=0;
for (m=1;m<=b;m++)
{
k=sqrt(m);
for (i=2;i<=k;i++)
if (m%i==0) break;
if (i>=k+1)
{
a[c]=m;
c++;
}
}
printf ("%d's prime numbers:\n",b);
for (j=0;j<c;j++)
printf ("%d ",a[j]);
printf ("\n");
}
}