-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPlusMinus.cpp
More file actions
47 lines (39 loc) · 727 Bytes
/
PlusMinus.cpp
File metadata and controls
47 lines (39 loc) · 727 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//#include<iostream>
//using namespace std;
#include<stdio.h>
#include<math.h>
int main()
{
int n,l=0,b=0,z=0;
//cin>>n;
scanf("%d",&n);
int a[n];
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(int j=0;j<n;j++)
{
if(a[j]<0)
{
l++;
}
if(a[j]>0)
{
b++;
}
if(a[j]==0)
{
z++;
}
}
double minus = l/n;
double posi = b/n;
double zero = z/n;
printf("%.5lf\n",minus);
printf("%.5lf\n",posi);
printf("%.5lf\n",zero);
//cout<<minus<<endl;
//cout<<posi<<endl;
// cout<<zero<<endl;
}