Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Collections Arrays Jagged Arrays

olu adesina
olu adesina
23,007 Points

help i dont know where to start

im not really sure where to start with is question. Im guessing max factor refers to the highest number

Math.cs
namespace Treehouse.CodeChallenges
{
    public static class MathHelpers
    {
        public static int[][] BuildMultiplicationTable(int maxFactor)
        {

        }
    }
}

2 Answers

David Tomko
David Tomko
7,744 Points

Well you're going to need to start by creating an Array of arrays like

  • int [][] arr = new int[You'll need this number to be one bigger than the number being passed in][];

Then you need a for loop with another for loop nested in it

  • The first for loop will be for the row and in here you'll need to create another int array like the one above but this one is only an int array and not an array of array
  • The second for loop with be for the value of the number in the rows
  • In this loop you'll multiple the two indexes of your for loops

In the end you'll need to add all this stuff to your array of arrays and return it

olu adesina
olu adesina
23,007 Points

David Tomko im still a little lost when you say the number being passed in what are you referring to

Steven Parker
Steven Parker
229,657 Points

That's right, "MaxFactor" is the highest value that will be used as an index for either dimension of the array. So your task is to create an "array of arrays" to accomodate those dimensions, and initialize the values with multiplication products.