Advertisement
Guest User

3.3

a guest
May 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 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 Lesson_3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Random rnd = new Random();
  14.             int[,] array = new int[3, 3];
  15.             int sum = 0, proiz = 1;
  16.  
  17.             Console.WriteLine("Массив:\n");
  18.             for (int i = 0; i < array.GetLength(0); i++)
  19.             {
  20.  
  21.                 for (int j = 0; j < array.GetLength(1); j++)
  22.                 {
  23.                     array[i, j] = rnd.Next(0, 10);
  24.                     Console.Write(array[i, j] + " ");
  25.                 }
  26.                 Console.WriteLine();
  27.             }
  28.             for (int i = 0; i < array.GetLength(0); i++)
  29.             {
  30.                 proiz *= array[i, 0];
  31.                 sum += array[1, i];
  32.             }
  33.  
  34.             Console.WriteLine("\nПроизведение первого столбца: " + proiz
  35.                 + "\n\nСумма второй строки: " + sum);
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement