你的编程习惯不是太好,有点乱;
#include <stdio.h>
#include <math.h>
void main ()
{ int i, k, a, count = 0; for (i=2; i<=100; i++) { k = sqrt (i); for (a=2; a<=k; a++) if (i%a==0) break; if (a>k) { printf ("%3d",i); count++; } if (count%10==0&&count!=0) { printf ("\n"); count = 0; } }
}