首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

为什么程序运行不对?解决思路

2012-02-05 
为什么程序运行不对??#include math.hmain(){longinti,x,yfor(i1i 100000i++){xsqrt(i+100)ysq

为什么程序运行不对??
#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);
}
}

热点排行