求各位前辈帮我看下 为什么我这个程序用while的输出 和用for的输出结果不一样呢
#include<stdio.h>#include<stdlib.h>
int main(void)
{
int count=0;
int count1=3;
int faulse=0;
int trail=5;
int *prim=NULL;
printf("\nHow many digits need ");
scanf("%d",&count);
count>4 ? count:4;
prim=(int*)malloc(count*sizeof(int));
while(count1<count)
{
*prim=2;
*(prim+1)=3;
*(prim+2)=5;
trail += 2;
for(int i=0;i<count1;i++)
{
faulse=trail%*(prim+i);
if(faulse==0)
break;
}
if(faulse>0)
{
*(prim+count1++)=trail;
}
}
while(--count1>=0)
{
if(count1%5==0)
{
printf("\n");
}
printf("%5d",*(prim+count1));
}
printf("\n");
for(int j=0;j<count;j++)
{
if(j%5==0)
{
printf("\n");
}
printf("%5d",*(prim+j));
}
return 0;
}