SHARE
TWEET

Untitled

a guest Nov 14th, 2019 88 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. void cit(int v[],int n)
  5. {
  6.    int i;
  7.    for(i=0;i<n;i++)
  8.    cin>>v[i];
  9. }
  10. int main()
  11. { int n,i,j,aux,dif;
  12. cin>>n;
  13. int v[n];
  14. cit(v,n);
  15. for(i=0;i<n-1;i++)
  16.     for(j=i+1;j<n;j++)
  17.         if(v[i]>v[j])
  18.         { aux=v[i];
  19.             v[i]=v[j];
  20.             v[j]=aux;
  21.         }
  22. dif=v[n-1]-v[0];
  23. //cout<<dif;
  24. aux=0;
  25. for(i=0;i<n;i++)
  26. if(dif==v[i])
  27.     aux++;
  28. cout<<'\n'<<aux;
  29.     return 0;
  30. }
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