|
[x]
Posted via EE Mobile
|
||
Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again. |
||
| 10/15/2009 at 02:09PM PDT, ID: 24816429 |
|
[x]
Attachment Details
|
||
|
[x]
The Solution Rating System
|
||
With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.
Your Input Matters If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support. Thank you! |
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: |
#include<stdio.h>
float func_mean(float array[], int n);
float largest(float array[], int n);
float smallest(float array[], int n);
int main(){
int n = 0;
int i;
float array[50];
float mean;
printf("\nPlease enter the elements: Note:-Please enter 0 to end inputing the numbers.\n");
for ( i=0; i<50; i++){
scanf ("%f",&array[i]);
if (array[i] == 0)
break;
n += 1;
};
printf("\nThe number of element you entered is %d", n);
printf("\n");
printf("\nThe numbers you entered are:\n");
for (i=0; i<n; i++)
printf("\n%f", array[i]);
printf("\n");
printf("\nThe largest element you entered is %f\n", largest(array, n));
printf("\nThe smallest element you enterd is %f\n", smallest(array,n));
mean = func_mean(array, n);
printf("\nThe mean you want to calculate is %f", mean);
}
float func_mean(float array[], int n){
int i;
float sum=0, mean;
for ( i=0; i<n ; i++ )
sum = sum + array[i];
mean = (sum/n);
return(mean);
}
float largest(float array[], int n){
int i;
float max;
max = array[0];
for (i=1; i<n; i++)
if (max < array[i])
max = array[i];
return(max);
}
float smallest(float array[], int n) {
int i;
float min;
min = array[0];
for (i=1; i<n; i++)
if (min > array[i])
min = array[i];
return(min);
}
|
Advertisement