Question: My code is correct. I just need help on my average because when I enter the three numbers im getting 90.67 for the average but

My code is correct. I just need help on my average because when I enter the three numbers im getting 90.67 for the average but it should be 90.66

Sample run:

Please enter 3 numbers: 100 80 92 

The average is: 90.66 The min is: 80

The max is: 100

#include #include using namespace std;

void minMaxAvg(int n1,int n2,int n3,int &min,int &max,double &average)

{ min=n1; if(min

max=n1; if(max>n2) max=n2; if(max>n3) max=n3; average=(n1+n2+n3)/3.0; }

int main() {

int n1,n2,n3,min,max; double average;

cout<<"Please enter 3 numbers: "; cin>>n1,n2,n3;

minMaxAvg(n1,n2,n3,min,max,average); cout<<"The average is: "<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!