Solved
Lower Triangle
Posted on 2006-05-07
hello,
I was working on a program which takes a value n from the user and prints a lower triangle that has the following sample format:
0
1 2
2 3 4
3 4 5 6
.........
I figured that if n an even integer then the number of rows or columns is n/2 +1.
Here is the code that I started using multi-dimensional arrays:
Void LowerHalf( int n, int theArray[][20])
{
for (int i=0; i < (n/2)-1; i++)
{
for (int j=0; j < (n/2)-1; j++)
{
cout << theArray[i][j]<< " "; //I have no idea what to do here
}
cout<<endl; // go to the next line
}
}
I am new to multi-dimensional array in C++ and I was just practicing Multi-dimensional arrays. Can you please help me fix what is wrong in the above code.
Thanks in advance!!!!