SHARE
TWEET

Untitled

a guest May 21st, 2019 54 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()
  6.  
  7. {
  8.  
  9.     unsigned long n, i, j, aux, v[1000];
  10.  
  11.     cin>>n;
  12.  
  13.     for (i=0; i<n; i++)
  14.  
  15.         cin>>v[i];
  16.  
  17.     for (i=0; i<n-1; i++)
  18.  
  19.         for (j=i+1; j<n; j++)
  20.  
  21.         if (v[i]<v[j])
  22.  
  23.         {
  24.  
  25.             aux=v[i];
  26.  
  27.             v[i]=v[j];
  28.  
  29.             v[j]=aux;
  30.  
  31.         }
  32.  
  33.         for (i=0;i<n;i++)
  34.  
  35.         cout<<v[i]<<' ';
  36.  
  37. }
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