Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#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;
}