VIzlo

Task 20

Sep 8th, 2022
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | Gaming | 0 0
  1. static void Main(string[] args)
  2.         {
  3.             int resultAddition = 0;
  4.             int resultMultiplication = 0;
  5.             int[,] arrayNumbers = { { 5, 3,2 }, { 5, 3, 2} };
  6.  
  7.             for (int i = 0; i < arrayNumbers.GetLength(0); i++)
  8.             {
  9.                 Console.WriteLine();
  10.  
  11.                 for (int b = 0; b < arrayNumbers.GetLength(1); b++)
  12.                 {
  13.                     Console.Write(arrayNumbers[i, b] + " ");
  14.                     resultAddition += arrayNumbers[1, b];
  15.  
  16.                     for (int j = 1; j < arrayNumbers.GetLength(0); j++)
  17.                     {
  18.                         resultMultiplication += (arrayNumbers[0, b] * arrayNumbers[0, j]);
  19.                     }                  
  20.                 }
  21.             }
  22.  
  23.             Console.WriteLine($"\nПроизведение: {resultMultiplication} ");
  24.             Console.WriteLine($"Сумма {resultAddition}");
  25.            
  26.         }
Advertisement
Add Comment
Please, Sign In to add comment