Hi,
i'm a newbie to program in C....I'm suppose to write to program that will find the smallest, largest, and average values in a collection of N numbers. Get the value of N before scanning each value in the collection of N numbers. Then compute and display both the range of values in the data collection and the standard deviation of the data collection...Standard deviation=sqrt((sum_squares / N) - average^2)

here's my code that i've written...but i can't figure out a way to get the smallest and the largest number....I have tried to get the smallest but i can't do it...I got the average with no problem.....
Any helps are appreciate...Thanks for reading this message...

2. urgent? urgent to who? certainly not urgent to me. i have other more pressing things on my mind. anyway, stupid internet explorer displays a mess when i bring up your attachment, so here is a fixed version (same exact code) that ie will not clobber.

Code:
```#include<stdio.h>
#include<math.h>

double standard_deviation (double sum_squares, double N, double average);

int main()
{
int count, N;
double num, sum, average;
double small;
double sum_squares, st_dev;

sum = 0.0;
average = 0.0;
count = 0;

printf("How many number?" );
scanf("%d",&N);
printf("Enter %d number and <Enter> after each> ", N);

while (count < N){
scanf("%lf",&num);
sum= sum + num;
average= sum / (double) N;
sum_squares = pow(sum, 2);
count = count + 1;
}

small = num;

while (++count < N){
scanf("%lf",&num);
if (small < num)
small = num;
}

/* function call */
st_dev = standard_deviation (sum_squares, N, average);

/* print the result */
printf("\nAverage=%.2f", average);
printf("\nSmallest=%.2f", small);
printf("\nStandard Deviation is %.2f\n", st_dev);

return (0);

}

double standard_deviation (double sum_squares, double N, double average)

{
double stand_dev;
stand_dev = sqrt((sum_squares / N) - pow(average, 2));
return (stand_dev);

}```

3. sorry i didn't know the rule at this board...but i will try to follow it the best i can...

4. Assuming you have the numbers in an array, to find the largest and / or the smallest, they use almost identical code. Here is the pseudo code for it:
Code:
```type someVariable, someCounter;
type someArray[SOME_SIZE];

someVariable = someArray[0]
for someCounter = 0; someCounter < SOME_SIZE; someCounter++
if someVariable < someArray[someCounter]
someVariable = someArray[someCounter]```
Basicly, go through each cell in the array. If you are finding the greatest, then compare that value in the array with some temproary variable. If the temporary value is greater, don't make the assigment. If the value in the array is greater than the temporary, then assign the value of that spot in the array to the temporary value.

When you reach the end of the array, you'll have your greatest value stored in the temproary value.

You can do the same thing for the minimum value.

Quzah.

5. Thanks for the quick reply quzah but my teacher does not teach me array yet so i don't think he would be very happy if i use in this program....again, thanks...

6. Thanks alot Salem...Let me try it out...