Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

What is cloud computing? How does it support business objectives?

Answered: 1 week ago

Question

1. Define mass and mediated communication

Answered: 1 week ago