Friday, October 7, 2022

a*a+b*b=c*c

 #include <time.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
int m=0,N = 1000;

for ( int i = 1; i <= N; i++)
for (int j = 1; j <= N; j++)
for (int k = 1; k <= N; k++)
{
if(k*k+i*i==j*j)
{
m++;
cout << k << "\t" << i << "\t" << j << "\n";
}
}
cout << "m=" << m << "\n";
return 0;
}


No comments:

Post a Comment

N-point Star in Microsoft Visual Studio Console App

#include <windows.h> #include <cmath> #include <iostream> LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,...