SHARE
TWEET

Untitled

a guest Apr 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(void){
  6.     int numbers[20];
  7.     for(int i=0;i<20;i++)
  8.         cin >> numbers[i];
  9.     for(int i=0;i<20;i++)
  10.         for(int j=0;j<20-i;j++){
  11.             if(numbers[j] > numbers[j+1]){
  12.                 int tmp = numbers[j];
  13.                 numbers[j] = numbers[j+1];
  14.                 numbers[j+1] = tmp;
  15.             }
  16.         }
  17.  
  18.     for(int i=0;i<20;i++)
  19.         cout << numbers[i] << " ";
  20.     cout << endl;
  21.     return 0;
  22. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top