Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- int a, b, c;
- int i[32000];
- cin >> n;
- for (a = 0; a < n; a++)
- {
- cin >> i[a];
- }
- for (a = 1; a < n; a++)
- {
- c = a;
- while (i[c] < i[c - 1] && c >= 1)
- {
- b = i[c];
- i[c] = i[c - 1];
- i[c - 1] = b;
- c--;
- }
- }
- for (a = 0; a < n; a++)
- {
- cout << i[a] << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement