Advertisement
Guest User

Untitled

a guest
Apr 10th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1.         private static void CounterOfElements(ulong[,] array)
  2.         {
  3.             //нахождение элементов, кратных 5 + поиск наибольшего кратного элемента в строке массива
  4.             for (int row = 0; row < array.GetLength(0); ++row)
  5.             {
  6.                 ulong bigElement = 0;
  7.                 ulong countTrueElements = 0;
  8.                 for (int column = 0; column < array.GetLength(1); ++column)
  9.                 {
  10.                     if ((array[row, column] % 5) == 0)
  11.                     {
  12.                         if (array[row, column] > bigElement)
  13.                         {
  14.                             bigElement = array[row, column];
  15.                         }
  16.                         ++countTrueElements;
  17.                     }
  18.                 }
  19.                 array[row, 0] = countTrueElements;
  20.                 array[row, 1] = bigElement;
  21.             }
  22.             Console.WriteLine();
  23.             for (int row = 0; row < array.GetLength(0); ++row)
  24.             {
  25.                 Console.WriteLine("X{0}: Количество элементов: {1}. Найбольший элемент: {2}.", row + 1, array[row, 0], array[row, 1]);
  26.             }
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement