Looking for some help with an assignment

The assignment "write a complete C++ program that declares a 2 dimensional integer array of size 10 rows and 10 columns. The program should use two nested for loops to fill the array as follows. If the row number is divisible by the column number then put the row number in the cell, otherwise put the column number in the cell. The program should then use nested for loops to print the array in table form to the screen."

Here is what I have:

#include<iostream>
using namespace std;


int main()
{
int i=10;
int j=10;
int board[10][10];
for(int i=0; i<9; i++)
{
for(int j=0; j<9; j++)
{
board[i][j] = 0;
}
}

for(int i=0; i<9; i++)
{
for(int j=0; j<9; j++)
{
cout << board[i][j] << " ";
}
cout << endl;
}
system("pause");
return 0;
}

After running it I get only 0's across the 10 rows and columns, its supposed to have numbers like in row column[0][0] a 0 next a 1 so on so forth but cant get anything other then 0 any suggestions?
I get only 0's across the 10 rows and columns


Do you think this might have something to do with that?
 
board[i][j] = 0;

You're setting every location of the array to zero.
Try putting some logic there to see if i (row number) is divisible by j (column number).

PLEASE USE CODE TAGS (the <> formatting button) when posting code.
Topic archived. No new replies allowed.