13,292,205 members (53,946 online)
Rate this:
See more:
How should I start coding this?
Posted 23-Nov-12 12:45pm
Updated 3-Dec-12 8:36am
v2
Sergey Alexandrovich Kryukov 23-Nov-12 18:18pm

Not a valid question. What's "how"?
--SA

Rate this:

## Solution 2

I would start with the first row (and the mathematical definition [^]).
You may use the recurrence relation (shown in the linked page) to compute their values (in a simple, rough approach, you might use a `10` x `10` array to store the numbers as computation proceedes).
v2
Rate this:

## Solution 4

This is a little simpler and more flexible implementation:

```public static void EeulerBernoulli(int limit)
{
var E = new List<int[]>();

for (int n = 0; n < limit; n++)
{
E.Add(new int[n + 1]);
for (int k = 0; k <= n; k++)
{
E[n][k] = (k != 0) ? (E[n][k - 1] + E[n - 1][n - k]) :
(n == 0 ? 1 : 0);
}
}
}```
Rate this:

## Solution 1

Just use an query like this

select TOP 10 from tablename
Rate this:

## Solution 3

```static void CreatEeulerBernoulli()
{
euler_Bernoulli[0, 0] = 1;
for (int i = 1; i < 10; i++)
{
if (i % 2 == 0)
evenArray(i);
else
oddArray(i);
}
WriteToScreen(euler_Bernoulli);
}

static void oddArray(int currentIndex)
{
for (int i = 0; i < currentIndex; i++)
{
int currentSum = 0;
for (int j = 0; j < currentIndex - i; j++)
currentSum = euler_Bernoulli[currentIndex - 1, j] + currentSum;

if (currentIndex >= i)
euler_Bernoulli[currentIndex, currentIndex - i] = currentSum;
}
}

static void evenArray(int currentIndex)
{
for (int i = 0; i < currentIndex; i++)
{
int currentSum = 0;
for (int j = i; j < 10; j++)
currentSum = euler_Bernoulli[currentIndex - 1, j] + currentSum;

if (currentIndex >= i)
euler_Bernoulli[currentIndex,  i] = currentSum;
}
}

static void WriteToScreen(int[,] result)
{
for (int i = 0; i < 10; i++)
{
Console.WriteLine("array index of " + i.ToString());
for(int k=0; k<10; k++)
Console.Write((result[i,k].ToString())+",");
}
}```
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 133 Jochen Arndt 130 CPallini 90 F-ES Sitecore 85 ppolymorphe 60
 OriginalGriff 1,896 Richard MacCutchan 1,000 Jochen Arndt 885 CPallini 865 ppolymorphe 834

Advertise | Privacy |
Web03 | 2.8.171207.1 | Last Updated 3 Dec 2012