nilai maksimum, minimum, dan rata
#include
main()
{
int arr[100], i, n, max=-999, min=999, x, j, k;
float total=0, rata;
printf("Masukkan jumlah data (maks. 100) = ");
scanf("%d",&n);
for(i=0;i
scanf("%d",&arr[i]);
}
//menentukan nilai max
for(x=0;x
max=arr[x];
}
}
printf("\nNilai Maksimum= %d",max);
//menentukan nilai min
for (j=0;j
}
}
printf("\nNilai Minimum= %d",min);
//menentukan rata2
for (k=0;k
}
printf ("\nJumlah =%2.2f",total);
rata=total/n;
printf("\nRata-rata=%2.2f",rata);
return 0;
}
0 Response to "nilai maksimum, minimum, dan rata"
Posting Komentar
asalammu'alaykum.wr.wb