#include <iostream>
#include <iomanip>
using namespace std;

const int COLS = 4;
const int TBL1_ROWS = 3;
const int TBL2_ROWS = 4;
int totalArray(const int[][COLS], int);

void showArray(const int [][COLS], int);

int main()
{
	int table1[TBL1_ROWS][COLS] = {{1 ,2 ,3 ,4},
								   {5, 6, 7, 8},
								   {9, 10, 11, 12}};
	int table2[TBL2_ROWS][COLS] = {{10, 20, 30, 40},
	                               {50, 60, 70, 80},
	                               {90, 100, 110, 120},
	                               {130, 140, 150, 160}};

	cout<<"The sum for all the elements in table1 is: "<< totalArray(table1,TBL1_ROWS)<<endl;
	
	cout<<"The sum of all elementsfor table2 is: "<< totalArray(table2, TBL2_ROWS)<<endl;
	
	return 0;
	
}

void showArray(const int numbers[][COLS], int rows)
{
	for (int x = 0; x < rows; x++)
	{
		for (int y=0; y<COLS; y++)
		{
			cout<< setw(4) << numbers[x][y] << " ";
		}
		cout <<endl;
	}
}

int totalArray(const int numbers[][COLS], int rows)
{
	int total=0;
	for(int div=0;div<rows;div++)
	for(int qrt=0;qrt<COLS;qrt++)
	total=total+numbers[div][qrt];
	
	return total;
}
