Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
496 B
0
Indexable
Never
#include <iostream>
using namespace std;

int main() {
	setlocale(LC_ALL, "Russian");
	int mas[100], max, min;
	for (int i = 0; i < 100; i++) {
		cin >> mas[i];
	}
	cout << "Ограничение сверху: ";
	cin >> max;
	cout << "Ограничение снизу: ";
	cin >> min;
	for (int i = 0; i < 100; i++) {
		if (mas[i] > max) {
			mas[i] = max;
		}
		if (mas[i] < min) {
			mas[i] = min;
		}
	}
	for (int i = 0; i < 100; i++) {
		cout << mas[i] << ' ';
	}
}
Leave a Comment