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 23 at 01:36 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
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 29 at 02:51 UTC
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 29 at 04:06 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
It's just not real code if it doesn't have at least 3 indentation-levels of boilerplate.
 
 
 
2012 Mar 31 at 01:15 UTC
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 15:55 UTC
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 Apr 1 at 00:51 UTC
SuperJer
Websiteman

2005 Mar 21 • 6666
 
 
 
2012 Apr 3 at 01:02 UTC
Page [1]