Make a c++ program that will print the average of the values of the three quizzes using function. The values of the quizzes are input values from the user.
#include <iostream>
using namespace std;
double average(double, double, double);
int main()
{
double n1, n2, n3;
cout << "Enter three integers:" << endl;
cin >> n1 >> n2 >> n3;
cout << "Average is " << average(n1, n2, n3) << endl;
}
double average(double a, double b, double c)
{
double averageValue = (a + b + c) / 3;
return averageValue;
}
Comments