I had a problem trying to make a small application to solve Project Euler Problem # 1 .
Whenever I try to run this, it returns as 0, not 233168.
I'm not necessarily looking for an absolute answer, just some of the tips 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(); } } } }
source share