SHARE
TWEET

Untitled

a guest Aug 19th, 2019 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace homework_03_3
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Random random = new Random();
  10.  
  11.             int[,] matrix = new int[3, 3];
  12.             int sum = 0;
  13.             int product = 0;
  14.  
  15.             // fill the array random numbers
  16.             for (int i = 0; i < matrix.GetLength(0); i++)
  17.             {
  18.                 for (int j = 0; j < matrix.GetLength(1); j++)
  19.                 {
  20.                     matrix[i, j] = random.Next(0, 100);
  21.                     Console.Write(matrix[i, j] + " ");
  22.                     if (matrix[i, j] / 10 <= 0) Console.Write(" ");
  23.                 }
  24.                 Console.WriteLine();
  25.             }
  26.  
  27.             sum = matrix[1, 0] + matrix[1, 1] + matrix[1, 2];
  28.             product = matrix[0, 0] * matrix[1, 0] * matrix[2, 0];
  29.             Console.WriteLine("\nСумма второй строки: " + sum);
  30.             Console.WriteLine("Произведение первого столбца: " + product);
  31.         }
  32.     }
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top