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)
-
Evaluate the following drafts. What parts should be omitted? What needs to be changed or added? What parts would benefit from specific supporting details? 1. Dear____: There is more to a buyers job...
-
The velocity of a certain atomic explosion blast wave has been determined to be approximately \(46,000 \mathrm{~m} / \mathrm{s}\) relative to the ground. Assume that it is moving into still air at...
-
True or False. The grid points in the finite difference methods are required to be uniformly spaced.
-
As inventory manager, you must decide on the order quantity for an item that has an annual demand of 2,000 units. Placing an order costs you $20 each time. Your annual holding cost, expressed as a...
-
Consider a system of a single spin, in thermal equilibrium with a reservoir of temperature T. Once an external magnetic field is applied, the spin can be in one of two states: aligned with the field...
-
Walmart makes significant investments in operating capacity, primarily via investments in property, plant, and equipment, but also via investments in wholly and partially owned subsidiaries. Walmart...
-
What domestic and international Argentina bonds trade the most? (Most likely going to be dollar denominated) What credit default swap information for Argentina would be the best to pull on Bloomberg...
-
Input: Ciphertext stored in four w-bit input registers A, B, C, D Number r of rounds w-bit round keys S[0;: : : ; 2r + 3] Output: Plaintext stored in A,B,C,D Procedure: Draw the special purpose...
-
Consider the following pseudo-code: for i=1 to n-1 do { // Assume i, j, k, n are integers for j=1 to i*i { k = 1; while (k < (n-i)) { perform ; k = k + 1; } } } Derive an expression for f(n), the...
-
Step 1: Choose one industry Choose one industry to research and analyze. Keep your topic focused on this single industry and the influence of NAFTA. Cars Electronics Agriculture You may propose a...
-
Problem 3: Presently, Able High Lift and Baker Overhead are the only suppliers of services that can lift heavy construction material to the heights required for high-rise construction projects the...
-
1. In the greater Stony Brook area there are many mom-and-pop pizza places. Despite their large number and great similarities in terms of costs and menus, each enjoy some degree of market power,...
-
public static int foo(int a, Strings) { s="Yellow"; a=a+2; return a; } public static void bar() { int a=2; String s= "Blue"; a = foo(a,s); System.out.println("a="+a+" s=" +s); } public static void...
-
To balance the chemical equation SiH3 + O2 SiO2 + HO, you could introduce coefficients a, b, c, d and write aSiH3 + bO2 cSiO + dHO then write linear equations for each element. The equation for Si...
-
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 /...
-
A university is deciding between two meal plans. One plan charges a fixed fee of \($600\) per semester and allows students to eat as much as they want. The other plan charges a fee based on the...
-
Evaluate this statement: You are a natural athlete, an attractive person who learns easily and communicates well. Clearly, you can do everything better than your friends and acquaintances. As a...
-
You have waited 30 minutes in a line for the Star Tours ride at Disneyland. You see a sign that says, From this point on, your wait is 45 minutes. You must decide whether to remain in the line or to...
Study smarter with the SolutionInn App