Advertisement
Guest User

massiv3.1

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