您的位置:首页 > 其它

平方具有对称性质的数(256以内)

2018-01-06 21:28 477 查看
#include<iostream>
#include<string>
using namespace std;
int main(){
int i,j,temp,count,flag,r,len;
char numstr[20]={0};
for(i=0;i<256;i++)
{
temp=i*i;
count=0;
while(temp!=0)
{
r=temp%10;
numstr[count]=r+'0';
count++;
temp/=10;
}
len=strlen(numstr);
flag=1;
for(j=0;j<len;j++)
{
if(numstr[j]!=numstr[len-j-1])
{
flag=0;
break;
}
}
if(flag==1)
{
cout<<"i"<<","<<i*i<<endl;
}

}
return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐