Advertisement
Guest User

#7

a guest
Oct 18th, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. inf f(int n,int a[100])
  5. {int i;
  6. for(i=1;i<=n;i++)
  7. if(a[i]<a[i+1])
  8. return 1;
  9. else
  10. if(a[i]>a[i+1])
  11. return 2;
  12. else
  13. if(a[i]==a[i+1]
  14. return 0;
  15. else
  16. return -1;
  17. }
  18. int mainn()
  19. {int n,a[100],i;
  20. cin>>n;
  21. for(i=1;i<=n;i++)
  22. cin>>a[i];
  23. cout<<f(n,a);
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement