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