# Answer to Question #12883 in C++ for shalennee

Question #12883

International Book Fair which was held for 30 days attracted many visitors. Only those visitors with passes were allowed to enter. Number of passes issued for each day was recorded.

(a) Calculates the total visitors who went to the book fair.

(b) Calculates the average number of visitors.

(c) Calculates the number of days which has the number of visitors more than 50.

(a) Calculates the total visitors who went to the book fair.

(b) Calculates the average number of visitors.

(c) Calculates the number of days which has the number of visitors more than 50.

Expert's answer

int visitors[30];

int ave=0;

int days=0;

for (int i=0;

i<30; i++){

cout<<"Enter the number of visitors on day

"<< i+1<<endl;

cin>>visitors[i];

ave=ave+visitors[i];

if (visitors[i]>50){

days=days+1;

}

}

ave=ave/30;

cout<<"Average

number of visitors "<<ave<<endl;

cout<<"Number of days

with more than 50 visitors "<<days<<endl;

int ave=0;

int days=0;

for (int i=0;

i<30; i++){

cout<<"Enter the number of visitors on day

"<< i+1<<endl;

cin>>visitors[i];

ave=ave+visitors[i];

if (visitors[i]>50){

days=days+1;

}

}

ave=ave/30;

cout<<"Average

number of visitors "<<ave<<endl;

cout<<"Number of days

with more than 50 visitors "<<days<<endl;

## Comments

## Leave a comment