Garloon

3.3

Aug 29th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _3._3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] array = new int[3, 3];
  14.             Random random = new Random();
  15.  
  16.             for (int i = 0; i < array.GetLength(0); i++)
  17.             {
  18.                 for (int j = 0; j < array.GetLength(1); j++)
  19.                 {
  20.                     array[i, j] = random.Next(1, 10);
  21.                     Console.Write(array[i, j] + " ");
  22.                 }
  23.                 Console.WriteLine();
  24.             }
  25.  
  26.             int sum = 0;
  27.             for (int j = 0; j < array.GetLength(1); j++)
  28.             {
  29.                 sum += array[1, j];
  30.             }
  31.             Console.WriteLine("\nСумма второй строки:" + sum);
  32.  
  33.             int mult = 1;
  34.             for (int i = 0; i < array.GetLength(0); i++)
  35.             {
  36.                 mult *= array[i, 0];
  37.             }
  38.             Console.WriteLine("\nПроизведение первого столбца: " + mult);
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment