levartolona

experiments_average

Jan 11th, 2020
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. experiment_t *journal_aver(experiment_t* journal, int size)
  2. {
  3.     for(int i = 0; i < size; i++)
  4.     {
  5.         int amount = (journal + i) -> amount;
  6.         double s = 0;
  7.         for (int j = 0; j < amount; j++)
  8.         {
  9.             s += *(((journal + i) -> results) + j);
  10.         }
  11.         *((journal + i) -> results) = s / amount;
  12.         (journal + i) -> amount = 1;
  13.     }
  14.  
  15.     return journal;
  16. }
Add Comment
Please, Sign In to add comment