The mean deviation (also called the mean absolute deviation) is the mean of the absolute deviations of a set of data about the data's mean. For a sample size , the mean deviation is defined by.
#include<stdio.h> #include<conio.h> void main() { int a[100],s=0,s1=0,b,n,i,mean; clrscr(); printf("Enter the Frequency :- "); scanf("%d",&n); printf("Enter %d Values in Array :- ",n); for(i=0; i<n; i++) { scanf("%d",&a[i]); } for(i=0; i<n; i++) { s=s+a[i]; } mean=s/n; for(i=0; i<n; i++) { b=a[i]-mean; s1=s1+b; } s1=s1/n; printf("Mean Deviation :- %d",s1); getch(); }