There are 2 soccer teams with the following statistics Write
Solution
Following is the required code in C
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void fillarray( int a[][3] ){
int length = sizeof( a )/sizeof( a[0] );
printf(\"%d\ \", length);
int i = 0;
for(; i < length; i++){
a[i][0] = (rand()%10 ) + 1;
a[i][1] = (rand()%6) + 1;
a[i][2] = (rand()%4) + 1;
}
}
void disparray( int a[][3] ){
int length = sizeof(a)/sizeof( a[0] );
printf(\"%d\ \", length);
printf(\"Player\\tMatches Played\\tGoals\\tYellow cards\ \");
int i = 0;
for(; i < length; i++){
printf(\"%d\\t%d\\t%d\\t%d\ \", i+1, a[i][0], a[i][1], a[i][2] );
}
}
void avgarray( int a[][3], float b[] ){
int length = sizeof(a)/sizeof( a[0] );
int i = 0;
for(; i < length; i++){
b[i] = (a[i][1]*1.0)/a[i][0];
}
}
int main(){
int a[4][3];
fillarray( a );
disparray( a );
float b[4];
avgarray(a,b);
}
