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