I have to do in the code from the numbers of txt me of the result of the calculation of the formulas of the mean and the median. I have many mistakes can you help me please.

Code:

#include <stdio.h>
#include <conio.h>
#include <string.h>
main
{
FILE *fp1,*fp2;
int i;
float A[4];
fp1 = fopen("datos.txt", "r"); //Abrimos el archivo
for(i=0;i<4;i++) //Iteramos i para ir almacenando los valores.
{
fscanf(fp1, "%f", &A[i]); // Leemos un float y lo guardamos en A en la posicion i
printf("Media [% d]: %.2f \n",i, A[i]);
}
{
printf("ponga el numero y despues enter");
int x[100],n,i ;
float mean (int,int []);
float mediana (int,int []);
scanf ("%d",&n);
for (i=0;i<n;i++)
scanf("%d",&x [i]);
printf ("media=%f\n ",mean(n,x));
printf ("mediana=%f\n",mediana (n,x));
getch ();
}
float mean (int m,int a []) {
int sum= 0,i;
for (i=0;i<m;i++ )
sum+=a[i];
return ((float)sum/m );
}
float mediana ( int n, int x []) {
float temp ;
int i,j;
for ( i=0; i<n-1;i ++ ) {
for (j=i+1;j<n;j++) {
if (x[j]<x[i]) {
temp=x[i];
x [i]=x[j];
x [j]= temp ;
}
}
}
if (n%2==0) {
return((x[n/2]+x[n/2-1])/2.0);
}
else
{
return x[n/2];
}
}
fclose(fp1);
}