int main(int argc, char *argv[]) {
float x,y[12];
int i,j;
for (i = 0; i < 12; i++){
printf("Month %d : ", i+1);
scanf("%f", &y[i]);
}
for (i = 11; i > 0; i--){
for (j = 11; j >= 12 - i; j--){
if (y[j] > y[j-1]){
x = y[j-1];
y[j-1] = y[j];
y[j] = x;
}
}
}
printf("Ssort descending:\n");
for (i = 0; i < 12; i++){
printf("%.2f ", y[i]);
}
printf("\nTop 3 months with highest sales amount\n");
for (i = 0; i < 3; i++){
printf("%.2f \n", y[i]);
}
return 0;
}
No comments:
Post a Comment