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 trialolu adesina
23,007 Pointshelp 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
namespace Treehouse.CodeChallenges
{
public static class MathHelpers
{
public static int[][] BuildMultiplicationTable(int maxFactor)
{
}
}
}
2 Answers
David Tomko
7,744 PointsWell 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
Steven Parker
231,248 PointsThat'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.
olu adesina
23,007 Pointsolu adesina
23,007 PointsDavid Tomko im still a little lost when you say the number being passed in what are you referring to