Sininerebane

Untitled

May 28th, 2024 (edited)
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | Software | 0 0
  1. namespace summaiumnozenie
  2. {
  3.     internal class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             Console.OutputEncoding = Encoding.UTF8;
  8.             Console.InputEncoding = Encoding.UTF8;
  9.             Random random = new Random();
  10.             int minValue = 1;
  11.             int maxValue = 10;
  12.             int rowIndex = 0;
  13.             int columnNumber = 1;
  14.             int sumResult = 0;
  15.             int multiplyResult = 1;
  16.             int[,] array = new int[3, 3];
  17.  
  18.             for (int i = 0; i < array.GetLength(0); i++)
  19.             {
  20.                 for (int j = 0; j < array.GetLength(1); j++)
  21.                 {
  22.                     array[i, j] = random.Next(minValue, maxValue);
  23.                     Console.Write(array[i, j] + " ");
  24.                 }
  25.  
  26.                 Console.WriteLine();
  27.            }
  28.  
  29.             for (int j = 0; j < array.GetLength(1); j++)
  30.             {
  31.                 sumResult += array[columnNumber,j];
  32.             }
  33.            
  34.             Console.WriteLine($"Cумму второй строки: {sumResult} ");
  35.            
  36.             for (int i = 0; i < array.GetLength(0); i++)
  37.             {
  38.                 multiplyResult *= array[rowIndex, i];
  39.             }
  40.            
  41.             Console.WriteLine($"Произведение первого столбц: {multiplyResult} ");
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment