Advertisement
dmitryEfremov

Untitled

Apr 13th, 2020
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.32 KB | None | 0 0
  1. using System;
  2. namespace ConsoleApp5
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             int[,] array = new int[3, 3];
  9.             Console.WriteLine("Заполните массив:");
  10.             for (int i = 0; i < array.GetLength(0); i++)
  11.             {
  12.                 for (int j = 0; j < array.GetLength(1); j++)
  13.                 {
  14.                     array[i,j] = Convert.ToInt32(Console.ReadLine());
  15.                 }
  16.             }
  17.             Console.WriteLine("Вы заполнили массив:");
  18.             for (int i = 0; i < array.GetLength(0); i++)
  19.             {
  20.                 for (int j = 0; j < array.GetLength(1); j++)
  21.                 {
  22.                     Console.Write(array[i,j] + " ");
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.             int sum = 0;
  27.             int productNumbers = 1;
  28.  
  29.             for (int j = 0; j < array.GetLength(0); j++)
  30.             {
  31.                 sum += array[1, j];
  32.             }
  33.             for (int j = 0; j < array.GetLength(1); j++)
  34.             {
  35.                 productNumbers *= array[j, 1];
  36.             }
  37.             Console.WriteLine($"Сумма 2 строки - {sum}. Произведение 2 столбца {productNumbers}.");
  38.             Console.ReadLine();
  39.         }    
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement