using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; /*Написать программу, которая все положительные элементы массива умножить на 2, а отрицательные умножить на 3 Написать программу, которая находит среднее арифметическое всех элементов двумерного массива*/ namespace ConsoleAppForGit { static internal class ArrayMethods { static public void ChangeArray(ref int[] array) { for (int i = 0; i < array.Length; ++i) { if (array[i] < 0) { array[i] *= 2; } else { array[i] *= 3; } } } static public double AvgOfTwoDimensionalArr(double[,] array) { double sum =0; int count =0; for (int i = 0;i < array.GetLength(0); ++i) { for (int j = 0; j < array.GetLength(1); ++j) { sum += array[i, j]; ++count; } } return sum / (count * 1.0); } } }