by Dinesh Thakur Category: Array

Each element of an array is a variable of the type declared for the array. Thus, if an array is declared as int Array [n],all its n elements are of type int, and all the operations that can be done on variables of type int may be carried out on the elements of this array. The same holds for arrays of types float, double, and char. In Program integer array elements are subjected to arithmetic operations.

#include <stdio.h>
#include<math.h>
void main()
{
  int x, y, z, i, Sum = 0;
  double Average_value = 0.0 , Sigma= 0.0;
  int Sample[] = {12,13,14,16,13,15,13,17,15,18,15,16,21,13,14};
  clrscr();
  x = sizeof (int);
      y = sizeof (Sample);
     z = y/x;
  for(i=0;i<=(z-1);i++)
     Sum+= Sample[i];
     Average_value = Sum / z;
     Sigma= sqrt(((Sample[i]-Average_value)*(Sample[i]- Average_value)) /(z-1));
     printf("Number of elements= %d\n", z);
     printf("Sum of elements= %d\n", Sum) ;
     printf("Sample average= %f\n", Average_value);
     printf("Sample std. deviation= %f\n", Sigma);
}   C Program determination of arithmetic mean and standard deviation


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles