C语言循环问题(急啊~!)在线等高人来

来源:百度知道 编辑:UC知道 时间:2024/05/16 15:30:33
3. 编程求满足方程 的整数解x的平方+y的平方=1994的整数解。

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define N (int)sqrt(1994)
int main()
{int x, y;
for(x=0;x<=N;x++)
for(y=0;y<=N;y++)
if(x*x+y*y==1994)printf("%d^2+%d^2=1994\n",x,y);
system("pause");
return 0;
}

#include "Stdio.h"
#include "Conio.h"

int main(void)
{
int i,j;
for(i=0;i<100;i++)
for(j=0;j<100;j++)
if(i*i+j*j==1994)
printf("x=%d y=%d\n",i,j);

getch();
return 0;
}