From 8fd223686e5f5c3729aff761ead41fa70121c7aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tommy=20=C3=96man?= Date: Sun, 16 Dec 2018 12:18:03 +0100 Subject: [PATCH] =?UTF-8?q?f=C3=B6rs=C3=B6kt=20hitta=20extremer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 2018_06/Program.cs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/2018_06/Program.cs b/2018_06/Program.cs index be68681..debb326 100644 --- a/2018_06/Program.cs +++ b/2018_06/Program.cs @@ -23,12 +23,31 @@ namespace _2018_06 } int points = 0; - foreach(Tuple tp in koords) + int al = 999+999, bl = 0; + int a1=999, a2 = 999; + int b1 = 0, b2 = 0; + + foreach (Tuple tp in koords) { points++; WriteLine($"point {points}, X: {tp.Item1} Y: {tp.Item2}"); + if (tp.Item1 + tp.Item2 < al) + { + a1 = tp.Item1; + a2 = tp.Item2; + } + + if (tp.Item1 + tp.Item2 > bl) + { + b1 = tp.Item1; + b2 = tp.Item2; + } } + WriteLine($"low value: {a1},{a2} high value: {b1},{b2}"); ReadKey(); + + + } } }