Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. int main()
  5. {
  6. int n=1, maxx1=0, maxx2=0;
  7. cin>>n;
  8. while(n!=0)
  9. {
  10. cin>> n;
  11. if(n>maxx1)
  12. {
  13. maxx2=maxx1;
  14. maxx1=n;
  15. }
  16. }
  17. if(maxx2!=0)
  18. cout << maxx2;
  19. else
  20. cout<< maxx1;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement