Skip to content

Commit

Permalink
Create Euler1
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-sm committed Jun 4, 2013
1 parent 394e5de commit 0491ffc
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions Euler1
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Euler Problem 1 - Multiples of 3 and 5
//Rextester.Program.Main is the entry point for your code. Don't change it.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
//Your code goes here
Console.WriteLine(SumMultiples(1000));
}

static int SumMultiples(int max)
{
var sum = 0;

for (int i = 1; i * 3 < max; i++)
{
if ((i * 3) % 5 != 0)
{
sum += (i * 3);
}

if (i * 5 < 1000)
{
sum += (i * 5);
}
}

return sum;
}
}
}

0 comments on commit 0491ffc

Please sign in to comment.