From 30936fa43552af80edce11b1ba4e24a0295879d7 Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Tue, 17 Nov 2020 14:47:16 -0500 Subject: [PATCH] solve problem 5 --- Program.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Program.cs b/Program.cs index d5cfc8b..2238fc5 100644 --- a/Program.cs +++ b/Program.cs @@ -97,8 +97,21 @@ namespace Euler { return largest; } + static long Problem5() { + for (long test = 20; ; test += 20) { + for (int i = 2; i <= 20; i++) { + if (test % i != 0) { + break; + } + if (i == 20) { + return test; + } + } + } + } + static void Main(string[] args) { - WriteLine(Problem4()); + WriteLine(Problem5()); } } } \ No newline at end of file