So I have this program running but the output is wrong. Im trying to display the maximum value of a list of numbers. Heres my program:

#include <iostream>
#include <iomanip>
using namespace std;

const int ROWS = 10;
const int COLS = 20;

void display(int [ROWS][COLS]); //function prototype

int main()
{

int i, j;
int val[ROWS][COLS] = {

10, 20, 121, 214, 142, 123, 1, 2, 3, 91, 94, 84, 499, 955, 294, 194, 5, 5, 6, 33,
30, 12, 124, 233, 213, 333, 2, 9, 2, 33, 94, 84, 949, 982, 654, 194, 5, 5, 6, 33,
99, 11, 333, 122, 342, 111, 4, 4, 3, 11, 94, 84, 949, 482, 424, 194, 5, 5, 6, 33,
33, 33, 211, 434, 432, 444, 2, 2, 1, 44, 94, 84, 949, 992, 324, 194, 5, 5, 6, 33,
94, 84, 949, 942, 294, 194, 5, 5, 6, 33, 94, 84, 949, 542, 294, 194, 5, 5, 6, 33,
95, 24, 249, 249, 491, 985, 3, 8, 3, 98, 10, 20, 121, 321, 142, 123, 1, 2, 3, 91,
30, 12, 124, 123, 213, 333, 2, 9, 2, 33, 94, 84, 949, 948, 298, 194, 5, 5, 6, 33,
99, 11, 333, 122, 342, 111, 4, 4, 3, 11, 94, 84, 949, 482, 944, 194, 5, 5, 6, 33,
33, 33, 211, 434, 432, 444, 2, 2, 1, 44, 94, 84, 949, 482, 754, 194, 5, 5, 6, 33,
94, 84, 949, 942, 294, 194, 5, 5, 6, 33, 94, 84, 949, 982, 724, 194, 5, 5, 6,
33};
display(val);

return 0;
}
void display(int nums[ROWS][COLS])
{
int rowNum, colNum, fmax, max, i;
for (rowNum=0; rowNum<ROWS; rowNum++)
{
for(colNum=0; colNum<COLS; colNum++)
cout << setw(4) <<nums[rowNum][colNum];
cout << endl;
}

fmax=nums[0][0];
if (nums[ROWS][COLS] > max)
max = nums[ROWS][COLS];
cout << max;
system("pause");
return;
}

It outputs the table fine but the max number is way off. I think it has something to do with the fmax at the end of the program. Any help would be useful Thanks