-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlusMinus.c
More file actions
29 lines (26 loc) · 606 Bytes
/
PlusMinus.c
File metadata and controls
29 lines (26 loc) · 606 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# PROGRAMMING-CODDING
#COMPETITIVE CODES OF HACAKERRANK AND OTHERS
#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 pos=0,neg=0,zer=0;
scanf("%d",&n);
int arr[n];
for(int arr_i = 0; arr_i < n; arr_i++){
scanf("%d",&arr[arr_i]);
if(arr[arr_i]>0)
pos++;
else if(arr[arr_i]<0)
neg++;
else
zer++;
}
printf("%.5f\n%.5f\n%.5f",(float)pos/n,(float)neg/n,(float)zer/n);
return 0;
}