Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int a[10] = { 1,2,-1,6,4,5,3,9,0,1 }, n = 10, min, max;
- for (int i = 0; i < n; i++) {
- cout << a[i] << " ";
- }
- min = max = a[0];
- for (int i = 1; i < n; i++) {
- if (a[i] < min) min = a[i];
- else if (a[i] > max) max = a[i];
- }
- cout << endl << min << ' ' << max;
- for (int i = n-1; i > n - 5; i--) a[i] = 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement