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
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started