9511_workbook

solved exercises from algorithms & programming I (9511) prof. Cardozo
Index Commits Files Refs README
guia05/ex10.c (281B)
   1 #include "ex10.h"
   2 
   3 #include <stdio.h>
   4 
   5 double standard_deviation(double *arr, size_t len)
   6 {
   7     if(arr == NULL) return -1;
   8 
   9     double sum, am;
  10     sum = 0;
  11     am = arithmetic_mean(arr, len);
  12     for(size_t n = 0; n <= len; n++)
  13         sum += pow((arr[n] - am), 2);
  14 
  15     return sqrt(sum / (len + 1));
  16 }