Advertisement
Josif_tepe

Untitled

Mar 12th, 2021
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n;
  8.     cin >> n;
  9.     int najmal = 2000000000;
  10.     int najgolem = -2000000000;
  11.     int niza[n];
  12.     for (int i = 0; i < n; i += 1)
  13.     {
  14.         cin >> niza[i];
  15.     }
  16.     for (int a = 0; a < n; a += 1)
  17.     {
  18.         if (najmal > niza[a])
  19.         {
  20.             najmal = niza[a];
  21.         }
  22.     }
  23.     for (int b = 0; b < n; b += 1)
  24.     {
  25.         if (najgolem < niza[b])
  26.         {
  27.             najgolem = niza[b];
  28.         }
  29.     }
  30.     cout << najmal + najgolem << endl;
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement