• + 0 comments

    Java 7 Solution

    double postiveNum=0,negativeNum=0;

        for(int x : arr)
        {
            if(x>0)
              postiveNum++;
            else if(x<0)
              negativeNum++;
    
        }
        System.out.printf("%.6f\n",(postiveNum/arr.size()));
        System.out.printf("%.6f\n",(negativeNum/arr.size()));
        System.out.printf("%.6f\n",((arr.size()-(postiveNum+negativeNum))/arr.size()));