juinda

Untitled

Jun 12th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int main(void)
  4. {
  5. int A[15];
  6. int i = 0, j, c, f = 0;
  7.  
  8. do
  9. {
  10. scanf(" %d", &A[i]);
  11. i++;
  12. } while (i<15);
  13. i = 0;
  14. do
  15. {
  16. i++;
  17. f = 1;
  18. j = 0;
  19. do
  20. {
  21. if (A[j]>A[j + 1])
  22. {
  23. c = A[j];
  24. A[j] = A[j + 1];
  25. A[j + 1] = c;
  26. f = 0;
  27. }
  28. j++;
  29. } while (j<(15 - i));
  30.  
  31. if (f == 1)
  32. break;
  33. j = 0;
  34. do
  35. {
  36. printf("%4d", A[j]);
  37. j++;
  38. } while (j<15);
  39. printf("\n");
  40. } while (i<15);
  41.  
  42. system("pause");
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment