kwest87

Untitled

Dec 11th, 2023
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.57 KB | None | 0 0
  1. [StatrCode]
  2. using System;
  3.  
  4. namespace ConsoleApp13
  5. {
  6.     internal class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Random randomNumber = new Random();
  11.             int[,] array = new int[3, 3];
  12.             int secondLineSum=0;
  13.             int secondLine = 1;
  14.             int multiplyingFirstColumn=1;
  15.             int firstColumn = 0;
  16.  
  17.             for (int i = 0; i < array.GetLength(0); i++)
  18.             {
  19.                 for (int j = 0; j < array.GetLength(1); j++)
  20.                 {
  21.                     array[i, j] = randomNumber.Next(10);
  22.                 }
  23.             }
  24.  
  25.             Console.WriteLine("Дан массив : ");
  26.  
  27.             for (int i = 0;i < array.GetLength(0); i++)
  28.             {
  29.                 for(int j = 0;j < array.GetLength(1); j++)
  30.                 {
  31.                     Console.Write(array[i,j]+ " ");
  32.                 }
  33.  
  34.                 Console.WriteLine();
  35.             }
  36.  
  37.             Console.WriteLine();
  38.  
  39.             for (int i = 0;i< array.GetLength(1); i++)
  40.             {
  41.                 secondLineSum += array[secondLine, i];
  42.             }
  43.  
  44.             Console.WriteLine($"Сумма второй строки данного массива : {secondLineSum}");
  45.             Console.WriteLine();
  46.  
  47.             for (int i = 0; i < array.GetLength(0); i++)
  48.             {
  49.                 multiplyingFirstColumn *= array[i, firstColumn];
  50.             }
  51.  
  52.             Console.WriteLine($"Произведение первого столбца : {multiplyingFirstColumn}");
  53.         }
  54.     }
  55. }
  56. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment