Advertisement
Josif_tepe

Untitled

Feb 25th, 2022
1,142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 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 niza[n];
  10.     for(int i = 0; i < n; i++)
  11.     {
  12.         cin >> niza[i];
  13.     }
  14.     int najmal = 2000000000;
  15.     int den = 0;
  16.     for (int i = 0; i < n; i++)
  17.     {
  18.        
  19.         if(niza[i] < najmal)
  20.         {
  21.             najmal = niza[i];
  22.             den = i + 1;
  23.         }
  24.     }
  25.     cout << den << " " << najmal << endl;
  26.     return 0;
  27. }
  28. /*
  29.  4
  30.  50 30 40 20
  31.  
  32.  3
  33.  **/
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement