fork download
  1. #include <stdio.h>
  2. int tab[6] = {1, 9, 12, 33, 46, 0};
  3. void wstawianie(int x)
  4. {
  5. int i = 4;
  6. while(i >= 0 && tab[i] > x)
  7. {
  8. tab[i+1] = tab[i];
  9. i--;
  10. }
  11. tab[i+1] = x;
  12. }
  13. int main()
  14. {
  15. int i;
  16. wstawianie(57);
  17.  
  18. for(i = 0; i < 6; i++)
  19. {
  20. printf("%d ", tab[i]);
  21. }
  22. return 0;
  23. }
Success #stdin #stdout 0s 5304KB
stdin
Standard input is empty
stdout
1 9 12 33 46 57