kwest87

Untitled

Dec 11th, 2023
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.54 KB | None | 0 0
  1. [StartCode]
  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.             Console.WriteLine();
  27.  
  28.             for (int i = 0;i < array.GetLength(0); i++)
  29.             {
  30.                 for(int j = 0;j < array.GetLength(1); j++)
  31.                 {
  32.                     Console.Write(array[i,j]+ " ");
  33.                 }
  34.  
  35.                 Console.WriteLine();
  36.             }
  37.  
  38.             for (int i = 0;i< array.GetLength(1); i++)
  39.             {
  40.                 secondLineSum += array[secondLine, i];
  41.             }
  42.  
  43.             Console.WriteLine($"Сумма второй строки данного массива : {secondLineSum}");
  44.  
  45.             for (int i = 0; i < array.GetLength(0); i++)
  46.             {
  47.                 multiplyingFirstColumn *= array[i, firstColumn];
  48.             }
  49.  
  50.             Console.WriteLine($"Произведение первого столбца : {multiplyingFirstColumn}");
  51.         }
  52.     }
  53. }
  54. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment