Write a program that creates a twodimensional array initiali
Solution
#include <iostream>
using namespace std;
const int row=3,col=3;
 int getTotal(int array[][col])
 {
    int total=0;
    for(int i=0;i<row;i++)
    {
        for(int j=0;j<col;j++)
        {
            total+=array[i][j];
        }
    }
    return total;
 }
double getAverage(int array[][col])
 {
    int total=0;
    for(int i=0;i<row;i++)
    {
        for(int j=0;j<col;j++)
        {
            total+=array[i][j];
        }
    }
    return (double)total / (row*col);
 }
int getRowTotal(int array[][col], int row)
 {
    row=row-1;
    int total=0;
    for(int j=0;j<col;j++)
    {
        total+=array[row][j];
    }
    return total;
 }
int getColTotal(int array[][col], int col)
 {
    col=col-1;
    int total=0;
    for(int j=0;j<row;j++)
    {
        total+=array[j][col];
    }
    return total;
 }
int getHighestInRow(int array[][col], int row)
 {
    row=row-1;
    int high=array[row][0];
   
    for(int j=1;j<col;j++)
    {
        if(array[row][j]>high)
        {
            high=array[row][j];
        }
    }
    return high;
 }
int getLowestInRow(int array[][col], int row)
 {
    row=row-1;
    int low=array[row][0];
   
    for(int j=1;j<col;j++)
    {
        if(array[row][j]<low)
        {
            low=array[row][j];
        }
    }
    return low;
 }
 int main()
 {
   
    int array[][col]={{2,4,5},{7,1,9},{5,2,3}};
    int total=getTotal(array);
    cout<<endl<<\"Total: \"<<total;
    double avg=getAverage(array);
    cout<<endl<<\"Average: \"<<avg;
    cout<<endl<<\"Total of elements in 2nd row: \"<<getRowTotal(array,2); //specify 1,2,3
    cout<<endl<<\"Total of elements in 1st column: \"<<getColTotal(array,1); //specify 1,2,3
    cout<<endl<<\"Highest element in 3rd row: \"<<getHighestInRow(array,3); //specify 1,2,3
    cout<<endl<<\"Lowest element in 2rd row: \"<<getHighestInRow(array,2); //specify 1,2,3
    return 0;
 }


