Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int array[100],n=10,c,d,temp,swap;
- srand(time(NULL));
- for(c=0;c<=10;c++)
- array[c]=rand()%50+50;
- for(c=0;c<=9;c++)
- {
- temp=c;
- for(d=c+1; d<n;d++)
- {
- if(array[temp]>array[d])
- temp=d;
- }
- swap = array[c];
- array[c] = array[temp];
- array[temp] =swap;
- }
- for(c=0;c<n;c++)
- printf("%d\n",array[c]);
- }
Advertisement
Add Comment
Please, Sign In to add comment