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 trialEilam Maimoni
Courses Plus Student 9,618 Pointscant understand how to solve the challenge...
I tried to solve this problem but couldn't understand how. Thanks for any help!
namespace Treehouse.CodeChallenges
{
public static class MathHelpers
{
public static int[][] BuildMultiplicationTable(int maxFactor)
{
int[][] sheet = new int[maxFactor][];
for (int rowI = 0 ; rowI <= maxFactor ; rowI++)
{
sheet[rowI] = new int[maxFactor];
for (int colI = 0 ; colI <= maxFactor ; colI++)
{
sheet[rowI][colI] = colI;
}
}
System.Console.WriteLine(sheet);
return sheet;
}
}
}
1 Answer
Steven Parker
231,198 PointsYou got pretty close! But the size of an array must be one more than the largest index you will use with that array. This would apply to the declarations for both dimensions.
Also remember this is a multiplication table. So the contents of any particular cell would be the column index multiplied by the row index.