Untitled

 avatar
unknown
c_cpp
2 years ago
994 B
5
Indexable
#include <iostream>
using namespace std;

int main()
{
	setlocale(LC_ALL, "Russian");
	int mas[5];

	int a; 
	cin >> a;

	for (int i = 0; i < 5; i++) {
		cin >> mas[i];
	}
	int sum = 0;

	for (int i = 0; i < 5; i++) {
		sum += mas[i];
	}

	int max = mas[0];
	int min = mas[0];
	int chel = 0;
	
	for (int i = 0; i < 5; i++) {
		if (max < mas[i])max = mas[i];
	}
	cout << "Сумма:" << sum << endl;

	for (int i = 0; i < 5; i++) {
		if (min > mas[i])min = mas[i];
	}
	cout << "Макс и мин: " << max << ' ' << min << endl;

	for (int i = 0; i < 5; i++) {
		if (max == mas[i])chel++;
	}
	cout << "Сумма макс элементов:" << chel << endl;

	int sum1 = 0;

	for (int i = 0; i < 5; i++) {
		if (a == mas[i])sum1++;
	}
	cout << "Количество элементов массива, равных A: " << sum1 << endl;

	int mas1[5];

	for (int j = 0; j < 5; j++) {
		mas1[j] = mas[j];
		cout << mas1[j] << ' ';
	}

}

Editor is loading...
Leave a Comment