Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a = 1, max1 = 0, max2 = 0;
- void step()
- {
- cin >> a;
- if (a > max1) {
- max2 = max1;
- max1 = a;
- }
- else if (a > max2)
- max2 = a;
- }
- int main()
- {
- while (a != 0)
- step();
- cout << max2;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement