Advertisement
Dani_info

dani

Feb 13th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int max1 = 0, max2 = 0, n, x;
  9.     cout << "cate nr se citesc??"; cin >> n;
  10.     for (int i = 1; i<= n; i++)
  11.     {
  12.         cout << "introdu nr:"; cin >> x;
  13.         if (x > max1)
  14.             max1 = x;
  15.         if (max1 > max2)
  16.             swap(max1, max2);
  17.     }
  18.     cout << max1 << endl << max2 << endl;
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement