Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (34 sloc) 848 Bytes
#include <stdio.h>
#include <float.h>
int main() {
int n;
scanf("%d", &n);
float f;
float min, max;
if (n == 0) {
min = FLT_MAX;
max = -FLT_MAX;
}
else {
float listOfNum[n];
for (int i=0; i<n; i++) {
scanf("%f", &f);
listOfNum[i] = f;
}
min = listOfNum[0];
max = listOfNum[0];
for (int i =0; i<n; i++) {
if (listOfNum[i] > max) {
max = listOfNum[i];
}
if (listOfNum[i] < min) {
min = listOfNum[i];
}
}
}
// DO NOT EDIT BELOW THIS LINE
printf("The minimum value is: %.05f.\n", min);
printf("The maximum value is: %.05f.\n", max);
/* Let the OS know everything is just peachy. */
return 0;
}
You can’t perform that action at this time.