#include <stdio.h>
typedef struct {
int num;
char name[20];
float score;
} Student;
int main() {
Student std[5] = {
{1, "Jae-won", 95.5},
{2, "Min-soo", 88.0},
{3, "Gildong", 95.5},
{4, "Ha-na", 92.0},
{5, "Duri", 89.0}
};
Student temp;
float low;
int idx;
for (int i = 0; i < 5; i++) {
low = std[i].score;
for (int j = 0; j < 4; j++) {
if (std[j].score < low) {
low = std[j].score;
idx = j;
temp = std[i];
std[i] = std[idx];
std[idx] = temp;
}
}
}
for (int i = 4; i >= 0; i--) {
printf("%.1f\n", std[i].score);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: