SHARE
TWEET

553

CristinaGeorgiu Jan 22nd, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<iostream>
  2. #include<climits>
  3. using namespace std;
  4. int v[1001];
  5. int main()
  6. {
  7.   int n,i,imax=0,imin=0,max,min;
  8.   max=INT_MIN;
  9.   min=INT_MAX;
  10.   cin>>n;
  11.   for(i=1;i<=n;i++)
  12.   {
  13.       cin>>v[i];
  14.   }
  15.   for(i=1;i<=n;i++)
  16.   {
  17.       if(v[i]>max)
  18.       {
  19.           max=v[i];
  20.           imax++;
  21.       }
  22.       if(v[i]<min)
  23.  
  24.       {
  25.         min=v[i];
  26.         imin++;
  27.       }
  28.   }
  29.   cout<<imin<<" "<<imax;
  30.   return 0;
  31. }
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