Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. public static double Miidi(double[] luvut)
  2. {
  3. double keskiarvo = 0;
  4. for (int i = 0; i < luvut.Length; i++)
  5. {
  6. keskiarvo = luvut[i] + keskiarvo;
  7.  
  8. }
  9. keskiarvo = keskiarvo / luvut.Length;
  10.  
  11.  
  12. double miidi = 0;
  13. for (int i = 0; i < luvut.Length; i++)
  14. {
  15. double etaisyys = keskiarvo - luvut[i];
  16. etaisyys = Math.Abs(etaisyys);
  17. if (etaisyys <= 0.4)
  18. {
  19. miidi = luvut[i];
  20. }
  21. }
  22.  
  23. return miidi;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement