diff options
| author | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
|---|---|---|
| committer | Sven Eisenhauer <sven@sven-eisenhauer.net> | 2023-11-10 15:11:48 +0100 |
| commit | 33613a85afc4b1481367fbe92a17ee59c240250b (patch) | |
| tree | 670b842326116b376b505ec2263878912fca97e2 /Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp | |
| download | Studium-master.tar.gz Studium-master.tar.bz2 | |
Diffstat (limited to 'Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp')
| -rw-r--r-- | Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp b/Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp new file mode 100644 index 0000000..259648e --- /dev/null +++ b/Bachelor/Prog1/Prakt2/prg1p2_3/prg1p2_3.cpp @@ -0,0 +1,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
\ No newline at end of file |
