You are viewing a single comment's thread. Return to all comments →
Why this code is not passing the test ?? If I em wrong somwhere please correct.It will be a great help from uuh guys.TIA.
#include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <limits.h> #include <stdbool.h> int main(){ int n; float P,N,Z; scanf("%d",&n); int arr[n],arr_i; for(int arr_i = 0; arr_i < n; arr_i++){ scanf("%d",&arr[arr_i]);} int positive,negative,zero; for(int arr_i = 0; arr_i < n; arr_i++){ if(arr[arr_i]>0) positive++; else if(arr[arr_i]<0) negative--; else zero++; } P=positive/n; N=negative/n; Z=zero/n; printf("%.6f \n %.6f \n %.6f \n ",P,N,Z); return 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 →
Why this code is not passing the test ?? If I em wrong somwhere please correct.It will be a great help from uuh guys.TIA.