Write a complete program that will have a main function and
     Write a complete program that will have a main function and a function called average. (Ret: slides 68 and 69 of lecW9_arrays, slides 47 to 49 of lec W6 fune)  a. Function average will only have a 2D integer array parameter with 2 rows and 3 columns. This function will return the average of the elements stored in 2D array. Use nested counter-controlled for loop. (Use array template instead of built-in array) h. In main(). declare a 2D integer array template called t with 2 rows and 3 columns, c. In main(). initialize the array using initializer list such that:  First row will have values 1, 2, 3 (from left to right)  Second row will have values 6, 8, 0 (from left to right)  d. Call the function average from main such that it will return the average of the elements stored in array  e. In main(), store the value returned from the function average in a variable. Then. print that variable. 
  
  Solution
The below is the code for the above problem in C language.
#include <stdio.h>
int average(int t[2][3]){
 int i,j;
 int average,sum=0;
 for (i = 0; i < 2; i++) {
 for (j = 0; j < 3; j++) {
 sum = sum+ t[i][j];
 }
 }
 average = sum/2*3;
 return average;
 }
int main()
 {
 int Avg;
 int t[2][3] = {{1, 2, 3}, {6, 8, 0}};
 Avg = average(t);
 printf(\"Average of the Elements: %d\ \",Avg);
 return 0;
 }
output is 30.

