输入两个数,求两个数之间的所有素数,弄了一夜,不知道哪里有错?
void panding( int a,int b ){
int flag=0;
int r,i,j;
if( a>b )
{
r=a;
a=b;
b=r;
}
for(i=a;i<=b;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0){
// printf("not sushu");
flag=1;
break;
}
}
if(flag==0){
printf("%d is sushu\n",i);
}
}
}
void shuru(int a[])
{
scanf("%d,%d",&a[0],&a[1]);
}
void main()
{
int shuzu[2]={0};
int jieguo[100]={0};
shuru(shuzu);
printf("the number you input is:%d,%d\n",shuzu[0],shuzu[1]);
panding(shuzu[0],shuzu[1]);
}