Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a = 1, max1 = 0, max2 = 0;
  4. void step()
  5. {
  6. cin >> a;
  7. if (a > max1) {
  8. max2 = max1;
  9. max1 = a;
  10. }
  11. else if (a > max2)
  12. max2 = a;
  13. }
  14. int main()
  15. {
  16. while (a != 0)
  17. step();
  18. cout << max2;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement