We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
publicstaticvoidplusMinus(List<int>arr){intn=arr.Count;if(n>0&&n<=100){intpositives=arr.Count(x=>x>0);intnegatives=arr.Count(x=>x<0);intzeros=arr.Count(x=>x==0);// Calculate and print ratios with 6 decimal placesConsole.WriteLine("{0:F6}",(decimal)positives/n);Console.WriteLine("{0:F6}",(decimal)negatives/n);Console.WriteLine("{0:F6}",(decimal)zeros/n);}}
Cookie support is required to access HackerRank
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 →