满足abcd=(ab+cd)的平方的数
写下代码!
写下代码!
2017-10-20
#include <stdio.h>
#include <math.h>
int getNum()
{
int abcd;
printf("满足要求的数有:");
for(abcd = 1000;i<10000;i++)
{
int ab,cd;
ab = (abcd / 1000) * 10 + ((abcd % 1000) / 100);
cd = (abcd % 100) / 10 * 10 + (abcd % 10);
if(abcd == pow(ab + cd,2))
{
printf("%d,",abcd);
}
}
}
int main()
{
getNum();
return 0;
}举报