C++ problem:
Write a function that:
double average(int n1, int n2, int n3) { return (n1 + n2 + n3) / 3.0; }
#include <iostream> using namespace std; double average(int n1, int n2, int n3); int main() { int n1, n2, n3; cout << "Enter three integers: "; cin >> n1 >> n2 >> n3; cout << "Average is " << average(n1, n2, n3) << endl; return 0; } double average(int n1, int n2, int n3) { return (n1 + n2 + n3) / 3.0; }
Get Answers For Free
Most questions answered within 1 hours.