QUESTION IMAGE
Question
jump to level 1
the mean of three numbers, value1, value2, and value3, is given by meanofthree = \frac{(value1 + value2 + value3)}{3.0}. read double variables value1, value2, and value3 from input, respectively. then, compute meanofthree using the formula. finally, output \mean is \ followed by the value of meanofthree to four digits after the decimal point. end with a newline.
ex: if the input is 24.0 36.0 6.0, then the output is:
mean is 22.0000
1 #include <iomanip>
2 #include <iostream>
3 using namespace std;
4
5 int main() {
6
7
8
9 return 0;
10 }
Step1: Include necessary headers
#include <iomanip>
#include <iostream>
using namespace std;
Step2: Declare variables and read input
int main() {
double value1, value2, value3;
cin >> value1 >> value2 >> value3;
Step3: Compute the mean
double meanOfThree = (value1 + value2 + value3) / 3.0;
Step4: Output the result
cout << fixed << setprecision(4) << "Mean is " << meanOfThree << endl;
return 0;
}Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
#include <iomanip>
#include <iostream>
using namespace std;
int main() {
double value1, value2, value3;
cin >> value1 >> value2 >> value3;
double meanOfThree = (value1 + value2 + value3) / 3.0;
cout << fixed << setprecision(4) << "Mean is " << meanOfThree << endl;
return 0;
}