// I have to do that in code from the numbers of txt me of the result of the calculation of the formulas of the mean and median
Code:
#include <stdio.h>
#include <conio.h>
#include <string.h>
int main (void)
FILE * fp1;
int i, j;
flotador A [4] [4], B [4] [4], C [4] [4];
fp1 = fopen ("data.txt", "r"); // Abra el archivo
para (i = 0; i <4; i ++) // Escribimos i, j para almacenar los valores.
para (j = 0; j <4; j ++)
{
fscanf (fp1, "% f", & A [i] [j]); // Leemos un flotador y lo almacenamos en A en la posición i, j
fscanf (fp1, "% f", & B [i] [j]); // Leemos un flotador y lo almacenamos en B en la posición i, j
printf ("Media [% d] [% d]:% .2f \ n", i, j, A [i] [j]);
printf ("Medio [% d] [% d]:% .2f \ n", i, j, B [i] [j]);
}
{
printf ("ingrese el número y luego ingrese");
int x [100], n, i;
media flotante (int, int []);
flotador medio (int, int []);
scanf ("% d", & n);
para (i = 0; i <n; i ++)
scanf ("% d", y x [i]);
printf ("media =% f \ n", media (n, x));
printf ("mediana =% f \ n", mediana (n, x));
getch ();
}
media flotante (int m, int a []) {
int sum = 0, i;
para (i = 0; i <m; i ++)
suma + = a [i];
retorno ((flotar) suma / m);
}
medio flotante (int n,
int x []) { temperatura flotante;
int i, j;
para (i = 0; i <n-1; i ++) {
para (j = i + 1; j <n; j ++) {
si (x [j] <x [i]) {
temp = x [yo];
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);
} [ADJUNTAR] 15768 [/ ADJUNTAR]