查无所获,请赐教!
/*回文质数 但输入123456 1123456时却无输出,不知为何,望高手解答*/
#include"stdio.h"
int sushu(unsigned long int a)
{
unsigned long int i;
for(i=2;i<=a;i++)
if(a%i==0)
break;
if(i==a)
return 1;
else
return 0;
}
int huiwen(unsigned long int a)
{
unsigned long int m,s,z=0;
m=a;
while(m)
{
s=m%10;
m=m/10;
z=z*10+s;
}
if(z==a)
return 1;
else
return 0;
}
main()
{
unsigned long int min,max;
scanf("%ld %ld",&min,&max);
if(min>=5&&min<max&&max<=100000000)
for(min;min<=max;min++)
if(sushu(min)&&huiwen(min))
printf("%ld\n",min);
}