Thursday, July 17, 2008

input real numbers and find the mean, variance and standard deviation

/* Write a C program to input real numbers and find the *
* mean, variance and standard deviation */

#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

This program is straight forward calculation of mean, variance and standard deviation from its formulae directly. It uses mathematical functions for simplicity. Hence reduce the execution length.


No comments: