SHARE
TWEET

Untitled

a guest Nov 12th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int min;
  7.     int min_position;
  8.     int max;
  9.     int max_position;
  10.     int liczba;
  11.  
  12.     min = 0;
  13.     max = 0;
  14.  
  15.     int i = 1;
  16.     while (cin >> liczba)
  17.     {
  18.         if (liczba < min) {
  19.             min = liczba;
  20.             min_position = i;
  21.         }
  22.         if (liczba >= max) {
  23.             max = liczba;
  24.             max_position = i;
  25.         }
  26.         i++;
  27.     }
  28.  
  29.     cout << min << endl;
  30.     cout << min_position << endl;
  31.     cout << max << endl;
  32.     cout << max_position << endl;
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top