#include #include using namespace std; // You have a sample of 100 values from a population with mean mu=500 // and with standard deviation sigma=80. Compute the interval that // covers the middle 95% of the distribution of the sample mean; in // other words, compute A and B such that P(A < x < B) = 0.95. Use the // value of z=1.96. Note that z is the z-score. // Confidence interval // mean - z * sigma/sqrt(n) // mean + z * sigma/sqrt(n) int main() { int n = 100; int mean = 500; // mu int stddev = 80; // sigma double zscore = 1.96; // 95% double A = mean - zscore * stddev / sqrt(n); double B = mean + zscore * stddev / sqrt(n); cout << fixed << setprecision(2) << A << endl; cout << fixed << setprecision(2) << B << endl; }