I have a question about the conditional test to store the smallest value, it is not a doubt, the problem is that when it prints, the value of the smallest value gets 0.0, which impairs to calculate the average correctly, at the highest value it worked, but not in the least, what could it be?
#include <stdio.h>
#define NUM 5
int main(){
int i, j;
float notas[NUM];
float media;
float maior=0, menor=0;
for(i=0; i<NUM; i++){
scanf("%f", ¬as[i]);
}
for(i=0; i<NUM; i++){
if(notas[i] >= notas[i+1]){
maior = notas[i];
}
else{
maior = notas[i+1];
}
}
for(i=0; i<NUM; i++){
if(notas[i] < notas[i+1]){
menor = notas[i];
}
else{
menor = notas[i+1];
}
}
for(i=0; i<NUM; i++){
media += notas[i];
}
media -= maior;//cálculo da média da escola
printf("%.1f %.1f %.1f\n", maior, menor, media);
printf("\n");
for(i=0; i<NUM; i++){
printf("%.1f ", notas[i]);
}
return 0;
}