You are viewing a single comment's thread. Return to all comments →
//java
class Solution { public static void main(String[] args) { Scanner scan= new Scanner(System.in); int n= scan.nextInt(); int arr[]= new int[n]; for(int i=0; i<arr.length; i++) { arr[i]= scan.nextInt(); } double zero=0, positive=0, negative=0; for(int i=0; i<arr.length; i++) { if(arr[i]==0) { zero++; } if(arr[i]>0) { positive++; } if(arr[i]<0) { negative++; } } System.out.format("%.6f\n", positive/n); System.out.format("%.6f\n", negative/n); System.out.format("%.6f\n", zero/n); } }
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