From ee96ad1f8090559c86ee849ecd4c418d413f4bfc Mon Sep 17 00:00:00 2001 From: Michael Johne Date: Sun, 12 Dec 2021 21:43:48 +0100 Subject: [PATCH] Add files via upload --- EulerBrick.csproj | 4 ++-- Program.cs | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/EulerBrick.csproj b/EulerBrick.csproj index 369eb1d..f2707e8 100644 --- a/EulerBrick.csproj +++ b/EulerBrick.csproj @@ -15,8 +15,8 @@ C:\Users\mj-pr\OneDrive\Documents\unlicense.txt Mijo Software https://mijo-software.de - 1.0.1.2 - 1.0.1.2 + 1.0.2.3 + 1.0.2.3 False diff --git a/Program.cs b/Program.cs index 707005e..e1cf53d 100644 --- a/Program.cs +++ b/Program.cs @@ -1,5 +1,5 @@ ulong - n = 0, + n = 0, i = 0, a_min = 1, b_min = 1, c_min = 1, a_max = 1000, b_max = 1000, c_max = 1000; @@ -21,11 +21,23 @@ if ((f % 1) == 0) { n++; - Console.WriteLine(value: $"{n} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}"); + if (a <= b && a <= c && b <= c) + { + i++; + Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}"); + } + else + { + Console.ForegroundColor = ConsoleColor.DarkGray; + Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}"); + Console.ForegroundColor = ConsoleColor.White; + } g = Math.Sqrt(d: Math.Pow(x: a, y: 2) + Math.Pow(x: b, y: 2) + Math.Pow(x: c, y: 2)); if ((g % 1) == 0) { - Console.WriteLine(value: $"{n} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}{{g: {Math.Round(a: (double)g)}"); + Console.ForegroundColor = ConsoleColor.Green; + Console.WriteLine(value: $"{n}|{i} = {{a: {a}, b: {b}, c: {c}}}{{d: {Math.Round(a: (double)d)}, e: {Math.Round(a: (double)e)}, f: {Math.Round(a: (double)f)}}}{{g: {Math.Round(a: (double)g)}"); + Console.ForegroundColor = ConsoleColor.White; } } }