#include
#include
#include
int main()
{
int low;
int high;
long num;
int i;
char tmp[8];
int sts;
memset(tmp,0,sizeof(tmp));
for(i=1;i<=256;i++){
num = i*i;
sprintf(tmp,"%ld",num);
if(strlen(tmp) < 2){
continue;
}
sts = 0;
low = 0;
high = strlen(tmp)-1;
while(high>=low){
if(tmp[high]==tmp[low]){
low = low +1;
high = high -1;
}else{
sts = 1;
break;
}
}
if(sts == 0){
printf("the x = %3d,x*x=%6ld\n",i,num);
}
}
return 0;
}
#include
void main()
{
int num,indv,ten,hundr;
for (num=1;num<=256;num++)
{
if (num>=100)
{
indv=num%10;
hundr=num/100;
if (indv==hundr)
printf("%d\n",num);
}
if (num<100)
{
indv=num%10;
ten=(num-indv)/10;
if (indv==ten)
printf("%d\n",num);
}
}
}
#include
#include
main()
{int i,x;
int b,c;
int flag;
for(i=10;i<256;i++)
{x=i;
b=x/10;
c=x%10;
if(b==c)
flag=1;
else
flag=0;
if(flag==1)
printf("%6d,",i);
}
getch();
}
第三个正解 可以考虑写成函数 好懂