Robert_Manea

sortare prin selectie

Jan 15th, 2020
77
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void sortare(int v[30],int n)
  2. {int i,j,l,min;
  3. for(i=0;i<n-1;i++){
  4. l=i;
  5. min=v[i];
  6. for(j=i+1;j<n;j++)
  7. if(v[j]<min){
  8. min=v[j];
  9. l=j;
  10. }
  11. v[l]=v[i];
  12. v[i]=min;
  13. }
  14. for(i=0;i<n;i++)
  15. printf("%d ",v[i]);}
RAW Paste Data