123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #include <iostream>
- #include <limits>
- int main() {
- int arr[3][3] = {
- {2, 1, 10},
- {2, 23, 23},
- {200, 9, 5}
- };
- int sum = 0;
- int minElement = std::numeric_limits<int>::max();
- int maxElement = std::numeric_limits<int>::min();
- int count = 0;
- for (int i = 0; i < 3; ++i) {
- for (int j = 0; j < 3; ++j) {
- int currentElement = arr[i][j];
- sum += currentElement;
- count++;
- if (currentElement < minElement) {
- minElement = currentElement;
- }
- if (currentElement > maxElement) {
- maxElement = currentElement;
- }
- }
- }
- double average = static_cast<double>(sum) / count;
- std::cout << "Сумма всех элементов: " << sum << std::endl;
- std::cout << "Среднее арифметическое: " << average << std::endl;
- std::cout << "Минимальный элемент: " << minElement << std::endl;
- std::cout << "Максимальный элемент: " << maxElement << std::endl;
- return 0;
- }
|