Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int n, a[1000], i, maxx = -1e9, S = 0, minn = 1e9, imin, imax, intre, x;
  8. cin >> n;
  9. for( i = 1; i <= n; i++){
  10. cin >> a[i];
  11. if( a[i] > maxx){
  12. maxx = a[i];
  13. imax = i;
  14. }
  15. if( a[i] < minn){
  16. minn = a[i];
  17. imin = i;
  18. }
  19. }
  20. cout << imin << " " << imax;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement