Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Massiv
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] array = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
- Random rand = new Random();
- int x = 0, y = 0;
- int sum = 0;
- int pr = 1;
- for (int i = 0; i < array.GetLength(0); i ++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- array[i, j] = rand.Next(0, 50);
- Console.SetCursorPosition(x, y);
- Console.Write(array[i, j]);
- x += 3;
- }
- x = 0;
- y += 1;
- }
- Console.Write("\nСумма второй строки: ");
- for (int i = 0; i < array.GetLength(0); i++)
- {
- sum += array[1, i];
- }
- Console.WriteLine(sum);
- Console.Write("Произведение первого столбца: ");
- for (int i = 0; i < array.GetLength(1); i++)
- {
- pr *= array[i, 0];
- }
- Console.WriteLine(pr);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement