Question #21350

Input a list of employee names and salaries, and determine the mean (average) salary as well as the number of salaries above and below the mean.

Expert's answer

#include <iostream>

using namespace std;

int main()

{

int k=0;

double averege;

int sum=0;

cout << "enter number& employee" << endl;

int n;

cin>>n;

char a[n];

cout << "enter employee names" << endl;

for(int i=1;i<=n;i++)

{

cin>>a[i];

}

& cout << "enter& employee salaries" << endl;

int b[n];

for(int i=1;i<=n;i++)

{

cin>>b[i];

sum= sum+ b[i];

}

& averege=sum/n;

for(int i=1;i<=n;i++)

{

& if(b[i]>=averege)

{

k=k+1;

}

}

cout<<"averege= "<<averege<<endl;

cout<<" number of salaries above and below the mean= " <<k<<endl;

return 0;

}

using namespace std;

int main()

{

int k=0;

double averege;

int sum=0;

cout << "enter number& employee" << endl;

int n;

cin>>n;

char a[n];

cout << "enter employee names" << endl;

for(int i=1;i<=n;i++)

{

cin>>a[i];

}

& cout << "enter& employee salaries" << endl;

int b[n];

for(int i=1;i<=n;i++)

{

cin>>b[i];

sum= sum+ b[i];

}

& averege=sum/n;

for(int i=1;i<=n;i++)

{

& if(b[i]>=averege)

{

k=k+1;

}

}

cout<<"averege= "<<averege<<endl;

cout<<" number of salaries above and below the mean= " <<k<<endl;

return 0;

}

## Comments

## Leave a comment