• + 0 comments

    Here is mine. It has also null check.

    public static void plusMinus(List arr) { double positiveQuantity, negativeQuantity, zeroQuantity = 0;

        foreach(var item in arr){
            if(item > 0) positiveQuantity++;
            else if(item < 0) negativeQuantity++;
            else zeroQuantity++;
        }
    
        int length = arr.Count;
    
        Console.WriteLine(positiveQuantity>0?(positiveQuantity/length):0);
        Console.WriteLine(negativeQuantity>0?(negativeQuantity/length):0);
        Console.WriteLine(zeroQuantity>0?(zeroQuantity/length):0);
    }