Askor

Hw15

Jul 2nd, 2020 (edited)
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Test
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int[,] array = new int[3,3];
  10.             Random rand = new Random();
  11.             int row = 1;
  12.             int column = 0;
  13.             int sum = 0;
  14.             int multipl = 1;
  15.  
  16.             for (int i = 0; i < array.GetLength(0); i++)
  17.             {
  18.                 for(int j = 0; j < array.GetLength(1); j++)
  19.                 {
  20.                     array[i, j] = rand.Next(1, 10);
  21.                     Console.Write($"{array[i,j]} ");
  22.                 }
  23.                 Console.WriteLine();
  24.             }
  25.  
  26.             for (int i = 0; i < array.GetLength(0); i++)
  27.             {
  28.                 sum += array[row, i];
  29.             }
  30.  
  31.             for (int i = 0; i < array.GetLength(0); i++)
  32.             {
  33.                 multipl *= array[i, column];
  34.             }
  35.  
  36.             Console.WriteLine($"\nSum: {sum} | Multiplication {multipl}");
  37.         }
  38.     }
  39. }
Add Comment
Please, Sign In to add comment