求大大给我纠错
#include "stdio.h"#include "stdlib.h"
#include "math.h"
main()
{
int palind(char str[],int k,int i);
int prime(char str[],int ip);
int i=0,n=0,m=0;
char str[20],ch;
printf("please input a number:\n");
for(;(ch=getchar())!='\n';i++)
str[i]=ch;
if(i%2==0)
n=palind(str,i/2,i-1);
else
n=palind(str,i/2-1,i-1);
if(n==0)
printf("not palindrome\n");
else
m=prime(str,i);
if(m==0)
printf("not prime number");
else
printf("is palindrome and prime number");
system("pause");
}
int palind(char str[],int k,int i)
{
if(str[k]==str[i-k]&&k==0)
return 1;
else if(str[k]==str[i-k])
palind(str,k-1,i);
else
return 0;
}
int prime(char str[],int ip)
{
int j,k,p=1,sum=str[0];
for(k=1;k<ip;k++)
{
p*=10;
sum=sum+str[k]*p;
}
printf("%d",sum);
for(j=2;j<=sqrt(sum);j++)
if(sum%j==0)
return 0;
if(j>sqrt(sum))
return 1;
}
prime函数怎么错了,求解释