Issue trying to solve Project Euler #1

c#

Solution

In the interests of helping you learn, I'm not going to provide the exact answer.

Have a look at the scoping of your `Console.WriteLine()` statement. My guess is that it's not running when you think it should be.

Problem

I'm having a problem trying to make a small app to solve Project Euler Problem #1. Whenever I attempt to run this, it returns as 0, instead of 233168. I'm not necessarily looking for an absolute answer, just some hints, I'm trying to learn. ``` using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { int x; List<int> listOne = new List<int>(); for (x = 1; x < 1000; ++x) { if(x%3 == 0 || x%5 == 0) { listOne.Add(x); } Console.WriteLine(listOne.Sum()); Console.ReadLine(); } } } } ```

Original source