Run ❯
Get your
own C#
server
❯
Run Code
Ctrl+Alt+R
Change Orientation
Ctrl+Alt+O
Change Theme
Ctrl+Alt+D
Change Language
Go to Spaces
Ctrl+Alt+P
using System; using System.Collections.Generic; using System.Linq; namespace MyApplication { class Program { static void Main(string[] args) { List
scores = new List
{ 45, 80, 62, 30, 95 }; // With a loop int total = 0; foreach (int score in scores) { total += score; } Console.WriteLine(total); // 312 // With LINQ Console.WriteLine(scores.Sum()); // 312 } } }
312
312