Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n = 10;
- vector <int> a(n);
- int mx = -1;
- for (int i = 0; i < n; ++i)
- {
- a[i] = rand() % 100;
- if (a[i] % 5 != 0)
- mx = max(mx, a[i]);
- cout << a[i] << ' ';
- }
- cout << '\n';
- cout << mx << '\n';
- for (int i = 0; i < n; ++i)
- {
- if (a[i] % 5 != 0)
- a[i] = mx;
- cout << a[i] << ' ';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement