kwest87

Untitled

Mar 28th, 2022
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. [StartCode]
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. namespace ConsoleApp2
  9. {
  10.     internal class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             int[,] places = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
  15.             int sum = 0;
  16.             int product = 0;
  17.  
  18.             for (int i = 0; i < places.GetLength(0); i++)
  19.             {
  20.                 for (int j = 0; j < places.GetLength(1); j++)
  21.                 {
  22.                     Console.Write(places[i, j]);
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.             sum = places[1, 0] + places[1, 1] + places[1, 2];
  27.             product = places[0, 0] * places[1, 0] * places[2, 0];
  28.             Console.WriteLine("Сумма второй строки " + sum + ". Произведение первого столбца " + product + ".");
  29.         }
  30.     }
  31. }
  32. [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment