#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);

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 of all elements for table1 is: " <<totalarray(table1,TBL1_ROWS);
	
	cout<<"\nThe sum of all elements for table2 is: "<<totalarray(table2,TBL2_ROWS);
	
	return 0;					
}

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;
	
}

