Plus Minus

  • + 0 comments

    in c# public static void plusMinus(List arr) {

        int positiveNum =0  ,  negativeNum=0 ,  zeros =0;
        int size = arr.Count(); 
        foreach(int x in arr ){
            if(x >0 ){
                positiveNum++;
            }    
             else if (x<0){
                 negativeNum ++;
             }
             else{
                 zeros++;
             }    
        }
        Console.WriteLine((positiveNum/(double)size).ToString("F6"));
        Console.WriteLine((negativeNum/(double)size).ToString("F6"));
        Console.WriteLine((zeros/(double)size).ToString("F6"));
    }