Program in C help me This program is going to store a number
Program in C help me
This program is going to store a number of inputs specified by the user in an array, then it will calculate statistical values such as the mean and standard deviation from the stored data. This program will be making use of the printf and scanf statements as well as the fabs and squareroot function, so include the appropriate c libraries. Problem description: As with last time, start the program with a sequence that asks the user for a number from two to ten, and based on this input, asks the user to input up to ten values taken from a hypothetical experiment. The program should then calculate the statistical mean of the given data points. It should also ask the user if there is a known value and if so, it should calculate the percent error from that value. The formula for calculating the mean of a number of N values is: x_mean = 1.0/n sigma_i = 1^n x_i The formula for the standard deviation is: sigma = squareroot 1.0/n - 1 sigma_i=1^n (x_i - x_mean)^2 The formula for the percent error is: PE= |x_mean - x_know/x_known| * 100 Algorithm development: Begin your program by having it ask the user for a number from 2 to 10. If the user inputs an incorrect value, it should ask for another number. Once the number of values has been chosen, declare a variable-length array using the input number, then the program should enter a for loop that counts from 0 to the value of n-1, asking the user new x value in each iteration of the loop. The x values should be stored in the array as they are input. Calculate the sum of the values in the array, the mean, and the standard deviation, (this will require two for loops, since you cannot calculate the standard deviation without first calculating the mean) Display the results on screen. Next, have the program ask the user if they want to review a specific value by subscript, or enter a known value, or quit. I recommend using numbered options: (Enter 1 for subscript review, 2 for percent error, 3 for quit, for example). If they to review a number, the program should ask them to input a subscript and then display the appropriate number. If they choose to enter a known value, it should ask them to enter the known value and calculate the corresponding percent error. For either of those choices, the program should continue asking the users to select one of the three options until they choose to terminate the program. If they chose to quit, it should terminate the program. Test your program with the following test data: Once you have finished the program, upload it to the dropbox on the course website. Remember to delete your original file! Do not leave the file unattended on your computer!Solution
Sum=587
Mean=97.83
Sd=14.02
pe=2.17
Please provide formula for subscript review
will complete that part
#include<stdio.h>
 #include<stdlib.h>
 #include<Math.h>
 int main()
 {
 printf(\"Enter the number of input values\ \");
 int n,i=0;
 scanf(\"%d\",&n);
 int a[n];
 float sum=0;
 for(i=0;i<n;i++)
 {
 printf(\"Enter number %d\ \",i+1);
 scanf(\"%d\",&a[i]);
 sum+=a[i];
 }
 printf(\"Sum of values is %f \ \",sum);
 float mean= sum/n;
 printf(\"Mean of values is %f \ \",mean);
 float sd=0;
 for(i=0;i<n;i++)
 {   
 sum+=(a[i]-mean)*(a[i]-mean);
 }
 sd = sqrt(sum/(n-1));
 printf(\"Standard deviation of values is %f \ \",sd);
 
 printf(\"Enter\ 1 for subscript review\ 2 for percent error\ 3 to quit\ \");
 int option;
 scanf(\"%d\",&option);
 
 switch ( option ) {
 case 1:
 /* Code */
 break;
 case 2:
 printf(\"Enter known value\ \");
 int kv;
 scanf(\"%d\",&kv);
 float pe = (fabs(mean-kv)/kv)*100;
 printf(\"Percent error is %f \ \",pe);
 break;
 case 3:
 return 0;
 break;
 default:
 break;
 }
 return 0;
 }


