/* Program 1 : Write a function int even(int A[][COL], int num_rows, int num_cols) that finds and returns the amount of the even elements among the elements of the array A. Write a program that randomly generates 3 two-dimensional arrays of size 3X4 (3 rows and 4 columns) each (range of the numbers between 0 and 10). The program prints each array and finds an array that has a maximal amount of the even elements. Use function even to count the amount of even elements in each array and use function we wrote in class to randomly generate an array of integers. Try to declare only one two-dimensional array and re-use this memory space 3 times by using loop structure. */ #include #include #include #define ROW 3 #define COL 4 int even(int A[][COL], int num_rows, int num_cols); void print_array(int A[][COL], int num_row, int num_col); void make_random_array2d(int A[][COL], int num_row, int num_col, int min, int max); int main(){ srand(time(NULL)); int i,count_array[3]={0}, array[ROW][COL], max, max_index; for(i=0;i<3;i++){ make_random_array2d(array, ROW, COL, 0,10); printf("array %d is\n",i+1); print_array(array, ROW, COL); count_array[i]= even(array, ROW, COL); } printf("counters array\n"); for(i=0;i<3;i++){ printf("%d ",count_array[i]); } printf("\n"); max=count_array[0]; max_index=0; for(i=1;i<3;i++){ if(count_array[i]>max){ max=count_array[i]; max_index=i; } } printf("max, max_index %d %d\n", max, max_index); return 0; } int even(int A[][COL], int num_rows, int num_cols){ int i, j, count=0; for(i=0;i