6 -4 3 -9 0 4 1
0.5 0.333333 0.166667
0.333333 0.666667 0
#include <iostream> using namespace std; int main() { int n=0; float temp1=0,temp2=0,temp3=0; int arr[]={}; cin>>n; for(int i=0; i<n; i++) { cin>>arr[i]; } for(int i=0;i<n;i++) { if(arr[i]>0) { temp1++; } else if(arr[i]<0) { temp2++; } else if(arr[i]==0) temp3++; } cout<<temp1/n<<endl; cout<<temp2/n<<endl; cout<<temp3/n<<endl; }
int arr[]={};
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)