0
why doesn't it work
Create a function that takes an array of numbers and returns the mean value. ( https://edabit.com/challenge/eETZxgueSqivPBmAX ) using System.Linq; public class Program { public static double Mean(int[] arr) => arr.Average(); } Says: FAILED: Expected: 2.5499999999999998d But was: 2.5454545454545454d so why does it work with all the other tests but not that one thanks for replies
2 ответов
+ 2
Michael Check notes in problem. You should get output upto 2 decimal point. Do like this
int[] arr = {1, 0, 4, 5, 2, 4, 1, 2, 3, 3, 3};
double x = arr.Average();
Console.Write(Math.Round(x, 2)); //2.55
0
Could you show your attempt here on the playground?