re: Daily Challenge #81 - Even or Odd VIEW POST

FULL DISCUSSION
 

c#, using linq, input validations omitted:

string evenOrOdd(string digitsOnly) 
{
    var evens = digitsOnly.Count(c => Char.GetNumericValue(c) % 2 == 0);
    var odds = digitsOnly.Length - evens;
    return evens > odds ? 
        "Even is greater than Odd" : 
        evens < odds ? 
            "Odd is greater than Even" : 
            "Even and Odd are the same";
}
code of conduct - report abuse