c语言 改错 求解
一个整数,加上100是一个完全平方数,加上168也是完全平方数,求这个数的大小。#include <stdio.h>
#include <math.h>
main()
{
int x;
float a,b;
a==sqrt(x+100);
b==sqrt(x+168);
for(x=1;x<100000;x++)
if(a==int(a)&&b==int(b))
printf("%d",x);
}
2015-11-09 21:01
2015-11-09 21:25
程序代码: int x;
float a,b;
for(x=1;x<100000;x++){
a=sqrt(x+100);
b=sqrt(x+168);
if((int)a==a&&(int)b==b)
printf("%d",x);
}

2015-11-09 21:28
2015-11-09 21:46
2015-11-09 21:48
2015-11-09 22:01
2015-11-09 22:01
程序代码:#include <stdio.h>
int main( void )
{
for( unsigned a=10,b=13; ; )
{
unsigned delta = b*b-a*a;
if( delta > 68 )
++a;
else if( delta < 68 )
++b;
else
{
printf( "%u\n", a*a-100 );
break;
}
printf( "a=%u b=%u\n", a, b );
continue;
}
return 0;
}输出 156
2015-11-10 08:33