Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,i,a[1000],maxi=0,nr=0,st,st_f,ok=0;
- cout<<"n=";cin>>n;
- for (i=0;i<n;i++)
- cin>>a[i];
- for (i=0;i<n;i++)
- {
- if (a[i]%2==0) {
- if (!ok) {
- st=i;
- ok=1;
- }
- nr++;
- }
- else
- {
- ok=0;
- nr=0;
- }
- if (maxi<nr)
- {
- st_f=st;
- maxi=nr;
- }
- }
- cout<<"lungime:"<<maxi<<"\nsecventa: ";
- for (i=st_f;i<st_f+maxi;i++)
- cout<<a[i]<<' ';
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement