klasscho

Untitled

Dec 9th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. float* Average(int** Matrixx, int n)
  2. {
  3. float Sum, Amount;
  4. float *Arr = new float[n];
  5. for (int i = 0; i < n; i++) {
  6. Sum = 0;
  7. Amount = 0;
  8. for (int j = 0; j < n; j++) {
  9. if (Matrixx[j][i] > 0) {
  10. Sum += Matrixx[j][i];
  11. Amount += 1;
  12. }
  13. Arr[i] = Sum / Amount;
  14. }
  15. }
  16. return Arr;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment