1. Write a program to calculate simple statistics (use the program developed below as a guide)....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write a program to calculate simple statistics (use the program developed below as a guide). Use an array to hold the data set input by the user and use loops to calculate the mean and variance of the data. Also compute the standard deviation. /* Compute the mean, standard deviation, and variance for a set of sample data * / #include <stdio.h> main () { int count, i; float mean, var, dp, stddev; mean = 0.0; var = 0.0; count = 10; for (i=1;i<= count; ++i) { scanf("%f", &dpt); mean = mean + dpt; } mean mean/count; for (i=1;i<= count; ++i) { scanf("%f", &dpt); var = var + ((meandpt) * (mean-dpt)); } var = var/count; stddev = sqrt (var); printf("%f %f %f\n", mean, var, stddev); Please, modify the program to accept data from a file. The file can be a simple column of numbers that you can generate using a text editor. Use fscanf to determine when the values read from the file are exhausted. 1. Write a program to calculate simple statistics (use the program developed below as a guide). Use an array to hold the data set input by the user and use loops to calculate the mean and variance of the data. Also compute the standard deviation. /* Compute the mean, standard deviation, and variance for a set of sample data * / #include <stdio.h> main () { int count, i; float mean, var, dp, stddev; mean = 0.0; var = 0.0; count = 10; for (i=1;i<= count; ++i) { scanf("%f", &dpt); mean = mean + dpt; } mean mean/count; for (i=1;i<= count; ++i) { scanf("%f", &dpt); var = var + ((meandpt) * (mean-dpt)); } var = var/count; stddev = sqrt (var); printf("%f %f %f\n", mean, var, stddev); Please, modify the program to accept data from a file. The file can be a simple column of numbers that you can generate using a text editor. Use fscanf to determine when the values read from the file are exhausted.
Expert Answer:
Answer rating: 100% (QA)
include include int main Declaring variables needed int i float m... View the full answer
Related Book For
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang
Posted Date:
Students also viewed these programming questions
-
South Side Oil and Gas, a new venture in Texas, has developed an oil pipeline network to transport oil from exploration fields to the refinery and other locations. There are 10 pipelines (branches)...
-
Suppose there are two goods in the world, beer and chips. The world consists of four economies: Elbonia, Genovia, Kinakuta, and Sodor. Labor is the only input into production, and one unit of labor...
-
Write a program to compute word ladders where single-character substitutions have a cost of 1, and single-character additions or deletions have a cost of p > 0, specified by the user. As mentioned at...
-
Concentric with the circle x 2 + y 2 + 2x 8y + 8 = 0 and passes through (2, 3)
-
Presented below are two independent situations. Situation A: Overtop Inc. reports revenues of $2,605,000 and operating expenses of $1,950,000 in its first year of operations, 2014. Accounts...
-
The following amounts summarize the financial position of Blythe Spirit Consulting, Inc. on May 31, 2017: During June 2017, the business completed these transactions: a. Received cash of $5,000, and...
-
The IT manager of Aztec Realty, Inc., prepared the balance sheet of the company while the accountant was ill. The balance sheet contains numerous errors. In par ticular, the IT manager knew that the...
-
A horizontal plank of mass m and length L is pivoted at one end. The planks other end is supported by a spring of force constant k (Fig P15.61). The moment of inertia of the plank about the pivot is...
-
Preventive maintenance is better than corrective maintenance . Why? Explain a scenario where this assertion is wrong. present your answer in powerpoint (ppt) your answer should not be more than 100...
-
Your company is considering acquiring a private company (New Co., Inc.). The CFO has asked you to review the financial statements, look for key trends, and develop financial/operational questions to...
-
Free market capitalism is driven by supply and demand, For the most part, supply is the business and demand is the consumer however a major signal is a price The behavior of buyers and sellers...
-
The ledger of Carla Vista Company contains the following balances: Owner's Capital $29,700, Owner's Drawings $1,400, Service Revenue $52.000, Salaries and Wages Expense $25,100, and Supplies Expense...
-
The reporting date of Trailer is 31 May 2020. On 1/6/18, Trailer acquired a building at a cost of $90m with a 30 year estimated useful life. On 31/5/19 the building was revalued at $75m. However, the...
-
Aging Infrastructure - The City of Toronto has some of the oldest buildings in Ontario, which presents a challenge for firefighters in terms of accessibility and safety. Provincial Issue: Funding -...
-
Techdirt was started in 1997 by Mike Masnick and grew into a blog that analyzes and offers insight into news stories about changes in government policy, technology, and legal issues that affect...
-
The purpose of the report is to analyze what you are learning in this course. Your audience is faculty and potential employers. Use all the material that is being provided in the course. Choose three...
-
Certain companies based in certain countries are able to overcome the substantial barriers to change and consistent innovation besides aggressively pursuing improvements and seeking competitive...
-
The following table shows the rates of total return in successive years from 2004 to 2008 for the Sprott Canadian Equity Fund and for the benchmark Toronto Stock Exchange S&P/TSX Composite Index. By...
-
A short value is stored in 16 bits. Write a program that prompts the user to enter a short integer and displays the 16 bits for the integer. Here are sample runs: Enter an integer: 5 JEnter The bits...
-
Use loops to simplify Programming Exercise 3.9 . Suppose x = 2 and y = 3. Show the output, if any, of the following code. 3 and y = 2? What is the output if x = 3 and y = 3? if (x > 2) if (y > 2) {...
-
Write a program that reads a Celsius degree in a double value from the console, then converts it to Fahrenheit and displays the result. The formula for the conversion is as follows: fahrenheit = (9 /...
-
The peak amplitude of a single-degree-of-freedom system, under a harmonic excitation, is observed to be \(5 \mathrm{~mm}\). If the undamped natural frequency of the system is \(5 \mathrm{~Hz}\), and...
-
A torsional system consists of a disc of mass moment of inertia \(J_{0}=10 \mathrm{~kg}-\mathrm{m}^{2}\), a torsional damper of damping constant \(c_{t}=300 \mathrm{~N}-\mathrm{m}-\mathrm{s} /...
-
The landing gear of an airplane can be idealized as the spring-mass-damper system shown in Fig. 3.52 [3.16]. If the runway surface is described \(y(t)=y_{0} \cos \omega t\), determine the values of...
Study smarter with the SolutionInn App