menghitung Nilai minimum dan MAX ~ Ivul varel

menghitung Nilai minimum dan MAX

#include <stdio.h>
int main ()
{

int n,i;
float nilai[30], max, min;
min=100000;
printf("Jumlah data (n) : ");
scanf("%d", &n);

  for(i=1; i<=n; i++) {
printf("Data ke %d : ",i);
scanf("%f", &nilai[i]);
 
if(max<nilai[i])
max=nilai[i];

if(min>nilai[i])
min=nilai[i];
}

printf("Nilai maksimum : %1.1f \n", max);
  printf("Nilai minimum : %1.1f \n", min);


return 0;

}

Previous
Next Post »
Post a Comment
Thanks for your comment