Advertisement
Vapio

task14

Apr 3rd, 2021
432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1. using System;
  2. using System.Text;
  3.  
  4. public class Program
  5. {
  6.     public static void Main()
  7.     {
  8.         int[,] numbers = {
  9.             { 1, 2, 5, 6, 7, 8 },
  10.             { 5, 7, 2, 6, 4, 8 },
  11.             { 4, 12, 9, 11, 13, 8 },
  12.             { -15, 3, 5, 6, 1, 8 }
  13.         };
  14.  
  15.         int rowSum = 0;
  16.         int rowSumNumber = 1;
  17.  
  18.         int columnMultiply = 1;
  19.         int columnMultiplyNumber = 0;
  20.  
  21.         for (int i = 0; i < numbers.GetLength(0); ++i)
  22.             columnMultiply *= numbers[i, columnMultiplyNumber];
  23.  
  24.         for (int j = 0; j < numbers.GetLength(1); ++j)
  25.             rowSum += numbers[rowSumNumber, j];
  26.  
  27.         for (int i = 0; i < numbers.GetLength(0); ++i)
  28.         {
  29.             for (int j = 0; j < numbers.GetLength(1); ++j)
  30.                 Console.Write(numbers[i, j] + " ");
  31.             Console.WriteLine();
  32.         }
  33.  
  34.         Console.WriteLine("Multiply of first column is : " + columnMultiply);
  35.         Console.WriteLine("Sum of second row is : " + rowSum);
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement