#include
#include
int main()
{
int n=10, h;
int a[n];
srand (time(NULL));
for (int i=0; i {
a[i] = rand() % 21 - 10;
printf ("%4d ", a[i]);
}
printf("\n");
for (int i=0; i h = a[i]; a[i] = a[n/2-i-1]; a[n/2-i-1] = h;
}
for (int i=n/2; i<3*n/4; i++){<br> h = a[i]; a[i] = a[3*n/2-i-1]; a[3*n/2-i-1] = h;
}
for (int i=0; i printf("\n");
return 0;
}
Пример:
-4 -10 -2 -8 3 -2 1 -5 -6 -5
3 -8 -2 -10 -4 -5 -6 -5 1 -2