Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n;
  8. cout<<"Podaj n: "; cin>>n;
  9. double tab[n];
  10. for(int i=0;i<n;i++)
  11. {
  12. cout<<"Podaj element: ";
  13. cin>>tab[i];
  14. }
  15. int ileZer(0);
  16. int maxi(-1);
  17. for(int i=0;i<n;i++)
  18. {
  19. if(tab[i]==0)
  20. {
  21. ileZer++;
  22. if(ileZer>maxi)
  23. maxi=ileZer;
  24. }
  25. else
  26. ileZer=0;
  27. }
  28. cout<<maxi;
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement