i need help for my school project in it. the function of the program is like a calculator that computes mean, median, mode, range, percentile, & standard deviation. and i dont know how to compute for mode, standard deviation and percentile. please they gave us dev c++ for out it subject in our senior year in highschool.
#include<stdio.h>
#include <math.h>
int main()
{
int Menu, Data, Choice, Counter=1, Num, Limit, Num1, Mean_Sum=0, Range, Max=0, Min=1, i;
float Mean, Median, Value, First_Value, Second_Value, mode, SD[100];
system("color f5");
printf("\t\t\t-------------------------------\n\n\n");
printf("\t\t H E A L T H F I T N E S S C O M P A N Y\n\n\n");
printf("\t\t\t-------------------------------\n\n\n");
printf("\t\t\tBY CHAN, DEMOLAR, DOMINGO, PINOL\n\n\n");
printf(" Describing datas of Hand Span, Wrist Circumference and Neck Circumference\n\n\n");
printf("\t\t\t\t4 - St. Francis Borgia\n\n\n\n");
printf("\t\t\t\tPress [1] for Start\n\n\t\t\t\t\t");
scanf("%d", &Menu);
while(Menu==1)
{
system("cls");
printf("DATA\n\n");
printf("Hand Span [1]\n\n\n");
printf("Wrist Circumference[2]\n\n\n");
printf("Neck Circumference[3]\n\n\n");
printf("Press [0] to go back.");
scanf("%d", &Data);
do
{
if(Data==1||Data==2||Data==3)
{
system("cls");
printf("What do you want to know?\n\n");
printf("Range[1]\n\n");
printf("Mean[2]\n\n");
printf("Median[3]\n\n");
printf("Mode[4]\n\n");
printf("Standard Deviation[5]\n\n");
printf("Percentiles[6]\n\n");
scanf("%d", &Choice);
}
if(Choice==1)
{
system("cls");
printf("Range - difference between the largest and smallest values\n");
printf("Range = MAXIMUM - MINIMUM\n\n");
printf("How many students?");
scanf("%d", &Num);
for(Counter=1;Counter<=Num;Counter++)
{
printf("Enter Value %d: ", Counter);
scanf("%d", &Num1);
if(Counter==1)
{
Min=Num1;
Max=Num1;
}
else if(Num1>=Max)
{
Max = Num1;
}
else if(Num1<=Min)
{
Min = Num1;
}
}
Range=Max-Min;
printf("\nRange of the data is %d" , Range);
printf("\nBack to Menu[1]");
scanf("%d",&Data);
}
else if(Choice==2)
{
system("cls");
printf("Mean - the sum of a collection of numbers divided by the number of numbers in the collection\n");
printf("\nHow many students?");
scanf("%d",&Limit);
while (Counter<=Limit)
{
printf("Enter data #%d:", Counter);
scanf("%d", &Num1);
Mean_Sum = Mean_Sum + Num1;
Counter++;
}
Mean = Mean_Sum/Limit;
printf("The mean is: %.2f", Mean);
getch();
printf("\n\nBack to Menu[1] ");
scanf("%d",&Data);
}
else if(Choice==3)
{
system("cls");
printf("Median - the numerical value separating the higher half of a data sample, a population, or a probability distribution, from the lower half.\n");
printf("\nHow many students?");
scanf("%d",&Num);
printf("Note: Remember to input the data from least to greatest.");
Counter=1;
while(Counter<=Num)
{
if(Num%2!=0)
{
Value=(Num+1)/2;
printf("\n\nEnter Value %d: ", Counter);
scanf("%d", &Num1);
if(Counter == Value);
Median=Num1;
Counter++;
}
else if (Num%2==0)
{
Value=(Num+1)/2;
printf("\n\nEnter Value %d: ", Counter);
scanf("%d", &Num1);
if(Counter==Value-0.5)
{
First_Value=Num1;
}
else if (Counter==Value+0.5)
{
Second_Value=Num1;
}
Median=(Second_Value+First_Value)/2;
}
}
printf("The median of the data is %.2f", Median );
getch();
printf("\n");
printf("Back to Menu[1] ");
scanf("%d",&Data);
}
else if(Choice==4)
{
system("cls");
printf("Mode - the value that appears most often in a set of data.\n");
printf("\nHow many students?");
scanf("%d",&Num);
printf("Back to Menu[1]");
scanf("%d",&Data);
}
else if(Choice==5)
{
system("cls");
printf("\n");
printf("\t\t\t\t STANDARD DEVIATION");
printf("\n");
printf("How many numbers?");
scanf("%d", &Num);
do
{
printf("Enter Value %d: ", Counter);
scanf("%d", &Num1);
Mean_Sum=Mean_Sum+Num1;
Mean=Mean_Sum/Num;
Counter++;
}
while (Counter<=Num);
printf("Back to Menu[1]");
scanf("%d",&Data);
}
else if(Choice==6)
{
system("cls");
printf("\n");
printf("\t\t\t\t PERCENTILES");
printf("\n");
printf("\n");
printf("\t\tMean is the average of all the data.");
printf("\n");
printf("\t\t\tmax=maximum value");
printf("\n");
printf("\t\t\tmin=minimum value");
printf("\n");
printf("\t\t\tRange= max-min");
printf("\n");
printf("\n");
printf("Back to Menu[1]");
scanf("%d",&Data);
}
else
{
system("cls");
printf("\n\t\t\tPlease Enter 1 to Go Main Menu:");
scanf("%d", &Data);
}
printf("Back to Menu:");
scanf("&d", &Data);
}
while(Data==0);
printf("Back to Menu:");
scanf("&d", &Data);
}
getch();
}