You are viewing a single comment's thread. Return to all comments →
C#
public static void plusMinus(List<int> arr) { int c = arr.Count; int p = 0; int n = 0; int z = 0; for (int i = 0; i < arr.Count; i++) { int e = arr[i]; if (e > 0) { p += 1; } else if (e == 0) { z += 1; } else { n += 1; } } Console.WriteLine(Math.Round((decimal)p/c, 6)); Console.WriteLine(Math.Round((decimal)n/c, 6)); Console.WriteLine(Math.Round((decimal)z/c, 6)); }
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 →
C#