Advertisement
Josif_tepe

Untitled

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