Euler Answers

Euler Answers

sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
http://projecteuler.net/problem=2
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int Lux = fibonacci_numbers();
Console.WriteLine(Lux);
Console.ReadLine();
}

private static int fibonacci_numbers()
{
// x=n-1
// y=n-2
int x = 3;
int[] array = new int[34];
int fib = 0;
array[0] = 0; array[1] = 1; array[2] = 1;
while (x < 34)
{
array[x] = array[x-1] + array[x-2];
x++;
}
foreach (int element in array)
{
if (element % 2 == 0)
{
fib += element;
}
}
return fib;
}
}
}
// 2
// 2
 
 
 
2012 Mar 22 at 18:36 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
Good job.

You're not really supposed to share your answer outside of the PE forums, though. B/c then people can see the answer before they figure it out themselves.
 
 
 
2012 Mar 28 at 19:51 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
sprinkles said:
http://projecteuler.net/problem=2
C# code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
...
}
}
}
// 2
// 2

That's worse than Java!
 
 
 
2012 Mar 28 at 21:06 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
It's just not real code if it doesn't have at least 3 indentation-levels of boilerplate.
 
 
 
2012 Mar 30 at 18:15 PDT
sprinkles

Chrome Whore
2009 Sep 6 • 2547
10 ₧
DR said you might have some cool projects/problems like this, superjer. If you do, would you share/make a contest for them?
 
 
 
2012 Mar 31 at 08:55 PDT
Down Rodeo
Cap'n Moth of the Firehouse

Find the Hole II Participation Medal
2007 Oct 19 • 5486
57,583 ₧
I was probably referring to his one-time challenges in this subforum thingy. Never did get them.
 
 
 
2012 Mar 31 at 17:51 PDT
SuperJer
Websiteman

2005 Mar 20 • 6629
 
 
 
2012 Apr 2 at 18:02 PDT
Page [1]