You are viewing a single comment's thread. Return to all comments →
Here is my C# solution...
int countPositive = arr.Count(e => e > 0); int countNegative = arr.Count(e => e < 0); int countZero = arr.Count(e => e == 0); string decimalPoints = "f6"; double percentPositive = (double)countPositive / n; double percentNegative = (double)countNegative / n; double percentZero = (double)countZero / n; Console.WriteLine(percentPositive.ToString(decimalPoints)); Console.WriteLine(percentNegative.ToString(decimalPoints)); Console.WriteLine(percentZero.ToString(decimalPoints));
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
Here is my C# solution...