Advertisement
Guest User

Proiect6

a guest
Apr 24th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.40 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a[20];
  6. int n,i,v,aux,k,o,nr,c;
  7. int main()
  8. {
  9.     cout<<"n= ";
  10.     cin>>n;
  11.     for(i=1;i<=n;i++)
  12.     {
  13.         cout<<"a["<<i<<"]=";
  14.             cin>>a[i];
  15.  
  16.     }
  17.     cout<<" afisare ";
  18.     for(i=1;i<=n;i++)
  19.     {
  20.      cout<<a[i];
  21.     }
  22.   /*   cout<<"v= ";
  23.     cin>>v;
  24.     n=n+1;
  25.     a[n]=v;
  26. */
  27. /*   for(i=1;i<=n;i++)
  28.    {
  29.     if(a[i]==6)
  30.     {
  31.         k=i;
  32.         for(i=k;i<=n;i++)
  33.         {
  34.          a[i]=a[i+1];
  35.         }
  36.         n=n-1;
  37.     }
  38.    }
  39. */
  40.   /*    v=a[n];
  41.       for(i=n;i>=1;i--)
  42.         {
  43.             aux=a[i];
  44.         a[i+1]=a[i];
  45.         a[i]=aux;
  46.         }
  47.       a[1]=v;
  48. */
  49.   /*  k=0;
  50.     while(k==0)
  51.     {
  52.         k=1;
  53.     for(i=1;i<n;i++)
  54.     {
  55.       if(a[i]<a[i+1])
  56.          {
  57.         aux=a[i];
  58.         a[i]=a[i+1];
  59.         a[i+1]=aux;
  60.         k=0;
  61.          }
  62.     }
  63.  
  64.     }*/
  65.    /* int nr;
  66.     int d;
  67.      cout<<"prime ";
  68.      for(i=1;i<=n;i++)
  69.      { nr=0;
  70.          for(d=2;d<=(a[i]/2);d++)
  71.          if(a[i]%d==0)
  72.             nr=nr+1;
  73.      if(nr==0)
  74.      a[i]=1;
  75.      else a[i]=0;
  76.      }*/
  77.       cout<<"oglindit ";
  78.       int o=0;
  79.       for(i=1;i<=n;i++)
  80.       { o=0;
  81.           while(a[i]!=0)
  82.        {
  83.         c=a[i]%10;
  84.         a[i]=a[i]/10;
  85.         o=o*10+c;
  86.       }
  87.       a[i]=o;}
  88.     cout<<endl;
  89.         for(i=1;i<=n;i++)
  90.     {
  91.      cout<<a[i]<<" ";
  92.     }
  93.     return 0;
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement