Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int N = 8;
- int main() {
- long a[N];
- long i, j=10001, k=0;
- for (i = 0; i<N; i++)
- cin >> a[i];
- for (i = 0; i<N; i++)
- if (a[i]<j)
- j=a[i];
- for (i = 0; i<N; i++)
- if (a[i]>k)
- k=a[i];
- for (i = 0; i<N; i++)
- if(a[i]=j){
- j=k;
- cout<<j<< " ";}
- else
- cout<<a[i]<< " ";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement