Advertisement
VoVfe

Untitled

Mar 21st, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.30 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 Работа_с_конкретными_строками
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] array = { { 4, 5, 8 }, { 3, 4, 7 } };
  14.             int sum = 0;
  15.             int composition = 1;
  16.  
  17.             for (int i = 0; i < array.GetLength(0); i++)
  18.             {
  19.                
  20.                 for (int j = 0; j < array.GetLength(1); j++)
  21.                 {
  22.                     Console.Write(array[i,j] + "");
  23.                     while (true)
  24.                     {
  25.                         if (i == 1)
  26.                         {
  27.                             sum += array[i, j];
  28.                         }
  29.                         if (j == 0)
  30.                         {
  31.                             composition *= array[i, j];
  32.                         }
  33.                         break;
  34.                     }
  35.                 }
  36.                 Console.WriteLine();
  37.  
  38.             }
  39.  
  40.             Console.WriteLine($"Сумма второй строки = {sum}");
  41.             Console.WriteLine($"Произведение первого столбца = {composition}");
  42.             Console.ReadKey();
  43.         }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement