Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int a[99999];
  6. int i=0;
  7. int x=999;
  8. int y;
  9. int h=-999;
  10. int k;
  11.  
  12. do {
  13. cin>>a[i];
  14. i++;
  15. } while(a[i-1]!=0);
  16.  
  17. i=0;
  18. while(a[i]!=0) {
  19. if(a[i]<x) {
  20. x=a[i];
  21. y = i;
  22. }
  23. if(a[i]>=h) {
  24. h=a[i];
  25. k = i;
  26. }
  27. i++;
  28. }
  29.  
  30. cout<<x<<endl;
  31. cout<<y+1<<endl;
  32. cout<<h<<endl;
  33. cout<<k+1;
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement