为什么程序运行不对??
#include <math.h>
main()
{
long int i,x,y;
for(i=1;i <=100000;i++)
{x=sqrt(i+100);
y=sqrt(i+168);
if(x*x=i+100&&y*y=i+168)
printf( "\n%ld\n ",i);
}
}
我用的tc,程序报错!高手帮我看看啊!
[解决办法]
#include <math.h>
main()
{
long int i,x,y;
for(i=1;i <=100000;i++)
{x=sqrt(i+100);
y=sqrt(i+168);
if(x*x=i+100&&y*y=i+168)
~~~~~~~~~~~~~~~~~~~~~~~~~
T\\应该是
if(x*x==i+100&&y*y==i+168)
~~ ~~~
printf( "\n%ld\n ",i);
}
}