You are viewing a single comment's thread. Return to all 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) ; }
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
C++ solution: