View difference between Paste ID: NK7NqUUd and jSeu9uuL
SHOW: | | - or go back to the newest paste.
1
double media (double *p, int elementos){
2
3
    int i;
4
    double sumatorio=0.0, media=0.0;
5
6
    for (i = 0; i < elementos; i++){
7
        sumatorio = sumatorio + *p;
8
        p++;
9
    }
10
11
    media = sumatorio / elementos;
12
13
    return(media);
14
}
15
16
17
double varianza (double *p, int elementos){
18
19
    int i;
20-
    double sumatorio = 0.0, varianza = 0.0, med = 0.0;
20+
    double sumatorio = 0.0, var = 0.0, med = 0.0;
21
22
    med = media (p, elementos);
23
24
    for (i = 0; i < elementos; i++){
25
        sumatorio = sumatorio + ((*p - med)*(*p - med));
26
        p++;
27
    }
28
29-
    varianza = sumatorio / elementos;
29+
    var = sumatorio / (elementos -1);
30-
    return (varianza);
30+
    return (var);
31
32
}