Advertisement
rootuss

3.24

Dec 16th, 2016
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cout << "Podaj ilosc liczb: ";
  9.     cin>>n;
  10.     int tablica[n];
  11.  
  12.  
  13.     for(int i=0;i<n;i++)
  14.     {
  15.         cin>>tablica[i];
  16.     }
  17.  
  18.     for(int i=0;i<n;i++)
  19.     {
  20.         cout<<tablica[i]<<endl;
  21.     }
  22.     int ilosc=n/2;
  23.  
  24.     int pom;
  25.  
  26.     for(int i=0;i<ilosc; i++ )
  27.  
  28.     {
  29.         pom=tablica[i];
  30.         tablica[i]=tablica[n-1-i];
  31.         tablica[n-1-i]=pom;
  32.     }
  33.  
  34.  
  35.     cout<<endl;
  36.     for(int i=0;i<n;i++)
  37.     {
  38.         cout<<tablica[i]<<endl;
  39.     }
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement