Here is all my code but I get a error with N/=10
it says:assignment of read-only parameter N
I don't know how to deal with it
it says:assignment of read-only parameter N
I don't know how to deal with it
Code:
#include<stdio.h>
#include<math.h>
int number(const int N);
int main()
{
int n1,n2,i,cnt;
scanf("%d %d",&n1,&n2);
cnt=0;
for(i=n1;i<n2;i++)
{
if(number(i))
cnt++;
}
printf("cnt=%d\n",cnt);
return 0;
}
int number(const int N)
{
int x,y;
int num[50]={0};
int b=10,count=0;
for(int j=1;;j++) //计算输入数值的总位数
{
if(N%b!=0) count+=1;
else break;
b/=10;
}
for(int y=0;y<count;y++) //将每一位 分别存储在数组中
{
int c=N%b;
num[y]=c;
N/=10;
}
for(y=0, x=count-1;y<count,x>=0;y++,x--)
{
if((num[y]==num[x])&&(sqrt(N)==(int)sqrt(N))) return 1;
else return 0;
}
}
Comment