| urejanje.c | |
|---|---|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | // DELO TABELAMI
// funkcija uredi stevila s[0], ..., s[n-1]
// po velikosti z uporabo bubble-sort metode
void uredi(int n, int s[]) {
int i, j,t;
for (i=0; i<n; i++)
for(j=0; j<(n-i-1); j++)
if (s[j] > s[j+1]) {
t = s[j];
s[j] = s[j+1];
s[j+1] = t;
}
}
// funkcija izpise tabelo na zaslon
void izpisiTabelo(int n, int s[]) {
int i;
for (i=0; i<n; i++)
printf("%d ", s[i]);
printf("\n");
}
|