GPbl3YH

CSLight #15

Jan 23rd, 2021 (edited)
933
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.31 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 CSLight
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int secondRowSum = 0;
  14.             int firstColumnMultiply = 1;
  15.  
  16.             int[,] doubleArray = {
  17.                 { 1, 2, 3, 4, 5 },
  18.                 { 9, 8, 7, 6, 5 },
  19.                 { 5, 4, 6, 3, 7 }
  20.             };
  21.  
  22.             for (int x = 0; x < doubleArray.GetLength(1); x++)
  23.             {
  24.                 secondRowSum += doubleArray[1, x];
  25.             }
  26.            
  27.             for (int x = 0; x < doubleArray.GetLength(0); x++)
  28.             {
  29.                 firstColumnMultiply *= doubleArray[x, 0];
  30.             }
  31.  
  32.             for (int x = 0; x < doubleArray.GetLength(0); x++)
  33.             {
  34.                 for (int y = 0; y < doubleArray.GetLength(1); y++)
  35.                 {
  36.                     Console.Write(doubleArray[x, y] + " ");
  37.                 }
  38.                 Console.WriteLine();
  39.             }
  40.  
  41.             Console.WriteLine("Произведение эл-ов 1го столбца = " + firstColumnMultiply);
  42.             Console.WriteLine("Сумма эл-ов 2й строки = " + secondRowSum);
  43.             Console.ReadKey();
  44.         }
  45.     }
  46. }
Add Comment
Please, Sign In to add comment