Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7.     int arrLength;
  8.     int temp;
  9.     int fmax = -2100000000, smax = -2100000000;
  10.  
  11.     cin >> arrLength;
  12.  
  13.     for (int i = 0; i < arrLength; i++) {
  14.         cin >> temp;
  15.  
  16.         if (temp > fmax)
  17.         {
  18.             smax = fmax;
  19.             fmax = temp;
  20.         }
  21.     }
  22.  
  23.     cout << smax << "\n";
  24.  
  25.  
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement