#include <stdio.h>
#include <conio.h>
#include <math.h>
#define MAXSIZE 10
void
main()
{
float
x[MAXSIZE];
int
i, n;
float
avrg, var, SD, sum=0, sum1=0;
clrscr();
printf
(
"Enter the value of N\n"
);
scanf
(
"%d"
, &n);
printf
(
"Enter %d real numbers\n"
,n);
for
(i=0; i<n; i++)
{
scanf
(
"%f"
, &x[i]);
}
for
(i=0; i<n; i++)
{
sum = sum + x[i];
}
avrg = sum /(
float
) n;
for
(i=0; i<n; i++)
{
sum1 = sum1 +
pow
((x[i] - avrg),2);
}
var = sum1 / (
float
) n;
SD =
sqrt
(var);
printf
(
"Average of all elements = %.2f\n"
, avrg);
printf
(
"Varience of all elements = %.2f\n"
, var);
printf
(
"Standard deviation = %.2f\n"
, SD);
}
Post a Comment