Advertisement
Guest User

Untitled

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