daily pastebin goal
26%
SHARE
TWEET

Untitled

a guest Jan 18th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3.  
  4. using namespace std;
  5.  
  6. signed main()
  7. {
  8.     int n;
  9.     cin >> n;
  10.  
  11.     int *mas = new int[n];
  12.     for (int i = 0; i < n; i++)
  13.     {
  14.         cin >> mas[i];
  15.     }
  16.  
  17.     for (int i = 0; i < n; i++)
  18.     {
  19.         for (int j = i + 1; j < n; j++)
  20.         {
  21.             if (mas[i] > mas[j])
  22.             {
  23.                 swap(mas[i], mas[j]);
  24.             }
  25.         }
  26.     }
  27.  
  28.     for (int i = 0; i < n; i++)
  29.     {
  30.         cout << mas[i] << endl;
  31.     }
  32.  
  33.     return 0;
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top