Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout<<"Vnesete n ";
- int n;
- cin>>n;
- int a[n];
- cout<<"Vnesete ja nizata: ";
- for(int i=1;i<=n;i++)
- {
- cin>>a[i];
- }
- int br=1;
- bool prekin=true;
- for(int i=1;i<=n;i++)
- {
- for(int j=i;j<=n;j++)
- {
- prekin=false;
- if(a[i]==a[j])
- {
- int lj=j;
- for(int zh=i;zh<=j/2;zh++)
- {
- if(a[zh]==a[lj])
- {
- prekin=true;
- lj--;
- }
- else
- {
- prekin=false;
- break;
- }
- }
- if(prekin)
- {
- for(int k=i;k<=j;k++)
- {
- cout<<a[k]<<", ";
- }
- cout<<endl;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement