Advertisement
TravaMan

Basic_Task12

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