• + 6 comments

    C++ solution:

    void plusMinus(vector<int> arr, int n) {
        int count_negative=0, count_zero=0, count_positive=0;
        for(int i=0; i<n; i++){
            arr[i] < 0 ? count_negative++ : arr[i]>0 ? count_positive++ : count_zero++;
        }
        cout << fixed << setprecision(6) << count_positive/(n*1.0) << "\n" << count_negative/(n*1.0) << "\n" << count_zero/(n*1.0) ;
    }