Advertisement
ZivkicaI

Isto i od napred i od nazad

May 19th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main()
  14. {
  15.    
  16.    int a[20], i, n;
  17.    cout<<"Vnesi kolku elementi kje ima nizata "<<endl;
  18.    cin>>n;
  19.    cout<<"Vnesi gi elementite na prvata nizata "<<endl;
  20.    for(i=0;i<n;i++)
  21.    {
  22.       cin>>a[i];
  23.    }
  24.    int flag=1;
  25.    int p=n;
  26.    for(i=0;i<n;i++)
  27.    {
  28.      if(a[i]!=a[p-1])
  29.      {
  30.          flag=0;
  31.      }
  32.      p--;
  33.    }
  34.    if(flag==1)
  35.    {
  36.        cout<<"Nizata se chita isto i od napred i od pozadi"<<endl;
  37.    }
  38.   else
  39.   {
  40.        cout<<"Nizata NE se chita isto od napred i od pozadi"<<endl;
  41.   }
  42.  
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement