Advertisement
Guest User

рапор

a guest
Mar 19th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. const int N = 8;
  4. int main() {
  5. long a[N];
  6. long i, j=10001, k=0;
  7. for (i = 0; i<N; i++)
  8. cin >> a[i];
  9.  
  10. for (i = 0; i<N; i++)
  11. if (a[i]<j)
  12. j=a[i];
  13.  
  14. for (i = 0; i<N; i++)
  15. if (a[i]>k)
  16. k=a[i];
  17.  
  18. for (i = 0; i<N; i++)
  19. if(a[i]=j){
  20. j=k;
  21. cout<<j<< " ";}
  22. else
  23. cout<<a[i]<< " ";
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement