#include <stdio.h>
#define LUNG 5
void leggiVettore(int v[], int dim)
{
int i;
printf("Inserire un vettore di interi di dimensione %d\n", dim);
for (i = 0; i < dim; i++)
scanf("%d", &v[i]);
}
void stampaVettore(int v[], int dim)
{
int i;
printf("Indice Elemento\n");
for (i = 0; i < dim; i++)
printf("%6d %8d\n", i, v[i]);
}
void invertiVettore(int v[], int dim)
{
int temp;
int i;
for (i = 0; i < dim/2; i++) {
temp = v[i];
v[i] = v[dim-1-i];
v[dim-1-i] = temp;
}
}
void invertiVettoreRic(int v[], int dim)
{
int temp;
if (dim > 1) {
temp = v[0];
v[0] = v[dim-1];
v[dim-1] = temp;
invertiVettoreRic(v+1, dim-2);
}
}
int main(void)
{
int vett[LUNG];
leggiVettore(vett, LUNG);
invertiVettore(vett, LUNG);
stampaVettore(vett, LUNG);
invertiVettoreRic(vett, LUNG);
stampaVettore(vett, LUNG);
return 0;
}