Examples of C part 53 display mean , variance and standard division
Program :
Output:
Enter number of terms
10
Enter Numbers
56
30
35
78
90
6
76
89
123
23
Mean for given numbers is 60.600000
Variance =1211.239990
Sandard Deviation=34.802872Explanation:
//Coming Soon
#include<stdio.h> #include<math.h> main() { int i,j,n; float mean,sum=0.0,sumMeanSquare=0.0,meanSquaredDifference,standardDeviation; printf("Enter number of terms\n"); scanf("%d",&n); float a[n],subtractMeanSquare[n]; printf("Enter Numbers\n"); for(i=0;i<n;i++) { scanf("%f",&a[i]); sum+=a[i]; } mean=(float)(sum/n); printf("Mean for given numbers is %f\n",mean); for(i=0;i<n;i++) { subtractMeanSquare[i]=(a[i]-mean)*(a[i]-mean); sumMeanSquare+=subtractMeanSquare[i]; } meanSquaredDifference=(float)(sumMeanSquare/n); standardDeviation=(float)(sqrt(meanSquaredDifference)); printf("Variance =%f\n",meanSquaredDifference); printf("Sandard Deviation=%f\n",standardDeviation); }
Enter number of terms
10
Enter Numbers
56
30
35
78
90
6
76
89
123
23
Mean for given numbers is 60.600000
Variance =1211.239990
Sandard Deviation=34.802872Explanation:
//Coming Soon