Advertisement
Guest User

Untitled

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