#include <stdio.h>
#include <stdlib.h>
#define N 10
float average(float a[], int n) {
float sum;
int i;
sum = 0.0f;
for (i = 0; i < n; i++) {
sum += a[i];
}
return sum / n;
}
float maximum(float a[], int n) {
float max;
int i;
max = a[0];
for (i = 1; i < n; i++) {
if (max < a[i]) {
max = a[i];
}
}
return max;
}
void bubblesort(float a[], int n) {
int i;
int j;
float t;
for (i = n - 1; 0 < i; i--) {
for (j = 0; j < i; j++) {
if (a[j] > a[j + 1]) {
t = a[j];
a[j] = a[j + 1];
a[j + 1] = t;
}
}
}
}
int main(void) {
int i;
float a[N];
float avr;
float max;
for (i = 0; i < N; i++) {
a
[i
] = rand() / (RAND_MAX
+ 1.0f); }
avr = average(a, N);
max = maximum(a, N);
bubblesort(a, N);
for (i = 0; i < N; i++) {
}
return EXIT_SUCCESS;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2RlZmluZSBOIDEwCgpmbG9hdCBhdmVyYWdlKGZsb2F0IGFbXSwgaW50IG4pIHsKICAgIGZsb2F0IHN1bTsKCWludCBpOwoJCglzdW0gPSAwLjBmOwoJZm9yIChpID0gMDsgaSA8IG47IGkrKykgewoJCXN1bSArPSBhW2ldOwoJfQoJCglyZXR1cm4gc3VtIC8gbjsKfQoKZmxvYXQgbWF4aW11bShmbG9hdCBhW10sIGludCBuKSB7CglmbG9hdCBtYXg7CglpbnQgaTsKCQoJbWF4ID0gYVswXTsKCWZvciAoaSA9IDE7IGkgPCBuOyBpKyspIHsKCQlpZiAobWF4IDwgYVtpXSkgewoJCQltYXggPSBhW2ldOwoJCX0KCX0KCQoJcmV0dXJuIG1heDsKfQoKdm9pZCBidWJibGVzb3J0KGZsb2F0IGFbXSwgaW50IG4pIHsKCWludCBpOwoJaW50IGo7CglmbG9hdCB0OwoJCglmb3IgKGkgPSBuIC0gMTsgMCA8IGk7IGktLSkgewoJCWZvciAoaiA9IDA7IGogPCBpOyBqKyspIHsKCQkJaWYgKGFb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