You are viewing a single comment's thread. Return to all comments →
Java
public static void plusMinus(List arr) { // Write your code here
double positive =0; double negative =0; double zeroes =0; for(int i=0; i<arr.size(); i++){ if(arr.get(i)>0){ ++positive; } else if(arr.get(i)<0){ ++negative; } else{ ++zeroes; } } System.out.println(String.format("%.6f", positive/arr.size())); System.out.println(String.format("%.6f", negative/arr.size())); System.out.println(String.format("%.6f", zeroes/arr.size())); }
}
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 →
Java
public static void plusMinus(List arr) { // Write your code here
}