Answered Essay: Write a C program using loops.

Write a C program using loops.

Problem 2 (40 points): Finding statistics of data set: Average, Standard Deviation and Maximum 1) Average Given a list of n data values/points: mi, m2, , mn, the average value is defined as average= mn- For example with 2 data values: with 3 data values: average = m1+m2 2 m1+m2 +m3 average- 3 We want to find the average value of incoming data without having to store all previous data values in memory. This can be done by 1) Find accumulated sum of all data values 2) Once all n data values are entered (for this problem, n is 8) average- accumulated sum / total number of data points b) Standard Deviation Once a user enters all numbers, the value of standard deviation can also be calculated as sum_squares sum_squares -2 standard deviation average2- Note: sum-squares = (ml) 2 + (m2) 2 + + (mn) 2 Hint: After each value is entered, your program should find the accumulated sum of each value square c) Maximum Once a user enters all numbers, maximum data point can be determined Hint: After each value is entered, your program should decide whether the entered value is a maximum of all entered value thus far. If it is, update the variable used to keep the maximum value

Problem 2 (40 points): Finding statistics of data set: Average, Standard Deviation and Maximum 1) Average Given a list of n data values/points: mi, m2, , mn, the average value is defined as average= mn- For example with 2 data values: with 3 data values: average = m1+m2 2 m1+m2 +m3 average- 3 We want to find the average value of incoming data without having to store all previous data values in memory. This can be done by 1) Find accumulated sum of all data values 2) Once all n data values are entered (for this problem, n is 8) average- accumulated sum / total number of data points b) Standard Deviation Once a user enters all numbers, the value of standard deviation can also be calculated as sum_squares sum_squares -2 standard deviation average2- Note: sum-squares = (ml) 2 + (m2) 2 + + (mn) 2 Hint: After each value is entered, your program should find the accumulated sum of each value square c) Maximum Once a user enters all numbers, maximum data point can be determined Hint: After each value is entered, your program should decide whether the entered value is a maximum of all entered value thus far. If it is, update the variable used to keep the maximum value

Expert Answer

 

//**************Code file*******

#include <stdio.h>

//limits.h allow us to initialize a variable value to its extreme value

//for example to find max we need to initilize the value to min value possible i.e INT_MIN

#include <limits.h>

//math.h allows to calculate x square by using pow(x,2) and square root by using sqrt(x)

#include <math.h>

int main()

{

//declare dataValue to store the data entered by the user

float dataValue;

//declare accumualted sum and sq sum variable and initlize it to 0

float accumulatedSum =0.0;

float accumulatedSumOfSq=0.0;

//declare average and standard deviation variable

float average,stddev;

//declare maximum variable and initilize it to minimum possible value possible

float maximum=INT_MIN;

int i; //variable i to iteration the for loop 8 time

for(i=1;i<=8;i++)

{

printf(“Enter data value:”);

//store the entered value into dataValue variable

scanf(“%f”,&dataValue);

//add entered value to accumulated sum variable so far

accumulatedSum = accumulatedSum + dataValue;

//add square of data entered to accumulated sum sq. value so far

accumulatedSumOfSq = accumulatedSumOfSq +pow(dataValue,2);

printf(“Accumulated sum of %d values is %0.2f n”, i, accumulatedSum );

printf(“Accumulated sum of square of %d values is %0.2fn”, i, accumulatedSumOfSq);

//if current maximum is less that data value entered the update the maximum to entered value

if(maximum<dataValue)

maximum = dataValue;

//print new line

printf(“n”);

}

//find average

average = accumulatedSum/8;

//find standard deviation using formula provided

stddev = sqrt(accumulatedSumOfSq/8-pow(average,2));

//print result after 8 iteration

printf(“Average: %0.2fn”, average);

printf(“Standard deviation: %0.2fn”,stddev);

printf(“Maximum : %0.2fn”,maximum);

}

//*********Output Screenshot*****************

‘//*****Code screenshot first half************’

//*****Code screenshot second half************

Buy Essay
Calculate your paper price
Pages (550 words)
Approximate price: -

Help Me Write My Essay - Reasons:

Best Online Essay Writing Service

We strive to give our customers the best online essay writing experience. We Make sure essays are submitted on time and all the instructions are followed.

Our Writers are Experienced and Professional

Our essay writing service is founded on professional writers who are on stand by to help you any time.

Free Revision Fo all Essays

Sometimes you may require our writers to add on a point to make your essay as customised as possible, we will give you unlimited times to do this. And we will do it for free.

Timely Essay(s)

We understand the frustrations that comes with late essays and our writers are extra careful to not violate this term. Our support team is always engauging our writers to help you have your essay ahead of time.

Customised Essays &100% Confidential

Our Online writing Service has zero torelance for plagiarised papers. We have plagiarism checking tool that generate plagiarism reports just to make sure you are satisfied.

24/7 Customer Support

Our agents are ready to help you around the clock. Please feel free to reach out and enquire about anything.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

HOW OUR ONLINE ESSAY WRITING SERVICE WORKS

Let us write that nagging essay.

STEP 1

Submit Your Essay/Homework Instructions

By clicking on the "PLACE ORDER" button, tell us your requires. Be precise for an accurate customised essay. You may also upload any reading materials where applicable.

STEP 2

Pick A & Writer

Our ordering form will provide you with a list of writers and their feedbacks. At step 2, its time select a writer. Our online agents are on stand by to help you just in case.

STEP 3

Editing (OUR PART)

At this stage, our editor will go through your essay and make sure your writer did meet all the instructions.

STEP 4

Receive your Paper

After Editing, your paper will be sent to you via email.