#include #define DIMENSIONE 10 main() { /* DISCHIARAZIONE DELLE VARIABILI */ int i, a[DIMENSIONE], index_max; /* Prendi in input 10 elementi e mettili nell'array a[] */ for(i=0; i< DIMENSIONE ; i++) { printf("\n Inserisci l'intero n. %d :",i); scanf("%d", &a[i]); } /* fine fase di INPUT */ for(i = 0; i <= 2; i++) { /* cerca il max tra a[i], a[i+1], .....,a[DIMENSIONE-1] */ index_max = i; for(j = i+1; j < DIMENSIONE; j++) { if(a[index_max] < a[j]) index_max = j; } /* SCAMBIA a[index_max] e a[i] */ temp = a[index_max]; a[index_max] = a[i]; a[i] = temp; } }