Following is the formula for calculating the Standard Deviat

Following is the formula for calculating the Standard Deviation of a set of values: (Where N is the number of elements:) x_mean = 1/N sigma_i=1^N x_i This can be done in C by keeping a running sum of numbers as the user enters them. In other words, you have a loop that runs, and every time the user inputs a new number \"x\", the number is added to the running sum \"xsum\". Write appropriate input and output statements for gathering a number \"x\" from the user, and add the value of x, once collected, to the running sum xsum.

Solution

#include <stdio.h>
int main()
{
   double x,xsum=0;
   int n;
   printf(\"Enter total number of elements\");
scanf(\"%d \", &n);
   for(int i=0;i<n;i++)
   {
       printf(\"Enter the number \");       //Input statement
       scanf(\"%d \", &x);
       xsum+=x;
   }  
   printf(\"Sum of all the elements = %d\", xsum);           //Output statement
return 0;
}

 Following is the formula for calculating the Standard Deviation of a set of values: (Where N is the number of elements:) x_mean = 1/N sigma_i=1^N x_i This can

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site