Advertisement
STANAANDREY

e2_3/4/2019

Apr 3rd, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.  unsigned n,i,v[1000],cif[1000],aux,j;
  7.  cout<<"n=";cin>>n;
  8.  for (i=0;i<n;i++)
  9.  cin>>v[i];
  10.  for (i=0;i<n;i++)
  11.  {
  12.      while (v[i]>10)
  13.          v[i]/=10;
  14.          cif[i]=v[i];
  15.  }
  16.  for (i=0;i<n-1;i++)
  17.   for (j=i+1;j<n;j++)
  18.     if (cif[i]>cif[j])
  19.   {
  20.       aux=cif[i];
  21.       cif[i]=cif[j];
  22.       cif[j]=aux;
  23.   }
  24.   for (i=0;i<n;i++)
  25.     cout<<cif[i];
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement