
1个回答
展开全部
#include<iostream>
using namespace std;
void search(int n)
{
int step,j=0,i1;
for(int i=1;i<n;i++)
{
i1=i;
step=10;
while((i1/10)!=0)
{
step=step*10;
i1=i1/10;
}
if((i*i)%step==i)
{
cout<<i<<endl;
j++;
}
}
if(j==0)
cout<<"Cannot find the number"<<endl;
}
int main()
{
int n;
cout<<"Please input the edge of the number"<<endl;
cin>>n;
search(n);
return 0;
}
1 1
5 25
6 36
25 625
76 5776
376 141376
625 390625
using namespace std;
void search(int n)
{
int step,j=0,i1;
for(int i=1;i<n;i++)
{
i1=i;
step=10;
while((i1/10)!=0)
{
step=step*10;
i1=i1/10;
}
if((i*i)%step==i)
{
cout<<i<<endl;
j++;
}
}
if(j==0)
cout<<"Cannot find the number"<<endl;
}
int main()
{
int n;
cout<<"Please input the edge of the number"<<endl;
cin>>n;
search(n);
return 0;
}
1 1
5 25
6 36
25 625
76 5776
376 141376
625 390625
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询