From 0bb17c73eff8fa71a2ae3a3e467dd74f1bc277a2 Mon Sep 17 00:00:00 2001 From: "jason.zhu" Date: Tue, 16 Feb 2021 03:42:26 +0000 Subject: [PATCH] Created foreach loop --- gradebook/src/GradeBook/Program.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/gradebook/src/GradeBook/Program.cs b/gradebook/src/GradeBook/Program.cs index d93ade6..a4a009d 100644 --- a/gradebook/src/GradeBook/Program.cs +++ b/gradebook/src/GradeBook/Program.cs @@ -6,6 +6,16 @@ namespace GradeBook { static void Main(string[] args) { + var numbers = new[] {12.7, 10.3, 1.1}; + double result = 0; + + foreach (var number in numbers) + { + result += number; + } + + System.Console.WriteLine(result); + if (args.Length > 0) { Console.WriteLine($"Hello, {args[0]}!");