Anonim_999

Untitled

Jan 9th, 2021 (edited)
919
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.08 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 ConsoleApp9
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int sum = 0, multiplication = 1;
  14.             int[,] array = { { 1, 2, 3 }, { 3, 4, 5 }, { 4, 5, 6 } };
  15.            
  16.             for (int i = 0; i < array.GetLength(1); i++)
  17.             {
  18.                 sum += array[1, i];
  19.             }
  20.  
  21.             for (int i = 0; i < array.GetLength(0); i++)
  22.             {
  23.                 multiplication *= array[i, 0];
  24.             }
  25.  
  26.             Console.WriteLine($"Сумма второй строки: {sum}\nПроизведение первого столбца: {multiplication}");
  27.             for (int i = 0; i < array.GetLength(1); i++)
  28.             {
  29.                 for (int j = 0; j < array.GetLength(0); j++)
  30.                 {
  31.                     Console.Write($"{array[i,j]} ");
  32.                 }
  33.                 Console.WriteLine();
  34.             }
  35.             Console.ReadKey();
  36.         }
  37.     }
  38. }
  39.  
Add Comment
Please, Sign In to add comment