GabrielloS

Матрица

Dec 6th, 2021 (edited)
446
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.97 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp8
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Random rand = new Random(); //класс random
  10.            
  11.             int stlb, strk;
  12.             Console.WriteLine("Введите количество строк:");
  13.             strk = Convert.ToInt32(Console.ReadLine()); //кол-во строк
  14.             Console.WriteLine("Введите количество столбцов:");
  15.             stlb = Convert.ToInt32(Console.ReadLine()); //кол-во столбцов
  16.  
  17.             int a = rand.Next(1, 100);
  18.             int[,] numbs = new int[a, a]; //ограничение чисел рандома
  19.  
  20.             for (int i = 0; i < strk; i++)
  21.             {
  22.                 for (int j = 0; j < stlb; j++)
  23.                 {
  24.                     Console.Write($"{numbs[i,j]} \t"); //матрица
  25.                 }
  26.                 Console.WriteLine();
  27.             }
  28.         }
  29.     }
  30. }
  31.  
Add Comment
Please, Sign In to add comment