summaryrefslogtreecommitdiffstats
path: root/Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp
blob: 259648e1ac776bfd2c80824211ea69e92d814e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Programmieren 1, Praktikum 2, Aufgabe 3
// Sven Eisenhauer
// 29.10.2004
//
// file: prg1p2_3.cpp
//
// purpose: find triangles, which fit a*a + b*b = c*c, for integer a,b,c < 500
//          
//
#include <iostream>
#include <iomanip>

using std::cin;
using std::cout;
using std::endl;
using std::setw;

int main()
{
	int a,b,c=1;

    cout <<setw(4)<<"A"<<setw(4)<<"B"<<setw(4)<<"C";

	for (a=1;a<500;a++)
		for (b=1;b<500;b++)
			for (c=1;c<500;c++)
				if ((a*a)+(b*b)==(c*c))
					cout <<setw(4)<<a<<setw(4)<<b<<setw(4)<<c<<endl;

	return 0; // so far, we are ok
}// end main