Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main (void)
- {
- int tab[6] = {4,2,5,3,6,1};
- int pom;
- int k;
- for(int i=0;i<6;i++)
- {
- k=i;
- for(int j=i+1;j<6;j++)
- {
- if(tab[j]<tab[k])
- {
- k=j;
- }
- }
- pom=tab[k];
- tab[k]=tab[i];
- tab[i]=pom;
- }
- for(int i=0;i<6;i++)
- {
- printf("%d ", tab[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement