Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  sfd
Language: C/C++
Code:
#include <stdio.h>
#include <stdlib.h>
int main(){
     int V[5];
     int i, k, j, f, s=0, num;
     
     printf("Inserire il primo valore");
     scanf("%d", &V[0]);
     for(k=1; k<5; k++){
          i=0;
          printf("Inserire valore");
          scanf("%d", &num);
          do{
               if(num<V[i])
                    s=1;
               else
                    i++;
          }while((s==0)&&(i<k));
          if(s==1){
               for(f=k;f>i;f--){
                    V[f]=V[f-1];
                    }
               V[i]=num;
          }
          else
           V[i]=num;
          }
     for(k=0; k<5; k++){
          printf("%d", V[k]);
          printf("  ");
          }
     
     system("PAUSE");
}
          
          
          
Comments: