69,370
社区成员
发帖
与我相关
我的任务
分享
#include <stdio.h>
void f5()
{
double r,s;
int a[100],i,j,k,q,w;
printf("\n\n一位、二位的平方数:");
for(i=0;i<=9;i++)
{
a[i]=i*i;printf("%4d",a[i]);
}
printf("\n\n金蝉平方数:");
for(i=sqrt(100);i<=sqrt(9876543210);i++)
{
r=s=i*i;
if(chongfu(s)!=1) continue;
w=log10(s)+1;
while(w>2)
{
r=fmod(r,pow(10,w-1)); //求余
r=(long)(r/10);
q=sqrt(r);
if(r!=q*q)
break;//goto h;
w=w-2;
}
if (w > 2)
continue;
for(j=0;j<=9;j++)
if(r==a[j])
printf("%6.0lf",s);
//h:;
}
}