You are viewing a single comment's thread. Return to all comments →
int s = arr.size(); float posi = 0.0f; float nega = 0.0f; float zero = 0.0f; for(int i=0; i0){ posi = posi+1; } else if(arr.get(i)<0){ nega = nega+1; } else{ zero = zero+1; }
} float a =(float) (posi/s); System.out.printf("%.6f%n",a); float b =(float) (nega/s); System.out.printf("%.6f%n",b); float c =(float) (zero/s); System.out.printf("%.6f%n",c);
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 →
int s = arr.size(); float posi = 0.0f; float nega = 0.0f; float zero = 0.0f; for(int i=0; i0){ posi = posi+1; } else if(arr.get(i)<0){ nega = nega+1; } else{ zero = zero+1; }