Professional Documents
Culture Documents
Untitled
Untitled
*
Q. Compute the average weight for a population of elephant seals read into an
array.
***********************************************************************************
*
#include <stdio.h>
#include <math.h>
#include <malloc.h>
#include <stdlib.h>
int a;
int b;
double sum=0.0;
int t = 1000;
for(a=0;a<row;a++)
{
for(b=0;b<column;b++)
{
sum+=mat[a][b];
}
}
return(sum/t);
int main()
int i;
int j;
int r=50;
int col=20;
FILE *file;
int** mat=malloc(r*sizeof(int*));
for(i=0;i<r;++i)
{
mat[i]=malloc(r*sizeof(int));
}
fclose(file);
return 0;