You are viewing a single comment's thread. Return to all comments →
Solution in C:
void plusMinus(int arr_count, int* arr) { int posnegzero[3] = {0,0,0}; for(int i=0; i < arr_count; i++) { (arr[i] > 0) ? posnegzero[0]++ : (arr[i] < 0) ? posnegzero[1]++ : posnegzero[2]++; } printf("%.6f\n%.6f\n%.6f\n",(float)posnegzero[0]/arr_count, (float)posnegzero[1]/arr_count, (float)posnegzero[2]/arr_count); }
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 →
Solution in C: