Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int[,] places = new int[3,3];
- int sum = 0;
- int product = 1;
- int line2 = 1;
- int pillar1 = 0;
- Random random = new Random();
- for (int i = 0; i < places.GetLength(0); i++)
- {
- for (int j = 0; j < places.GetLength(1); j++)
- {
- Console.Write(places[i, j]=random.Next(1,10));
- }
- Console.WriteLine();
- }
- for (int i = 0; i < places.GetLength(0); i++)
- {
- for (int j = 0; j < places.GetLength(1); j++)
- {
- if (i == line2)
- {
- sum = sum + places[i, j];
- }
- if (j == pillar1)
- {
- product = product * places[i, j];
- }
- }
- }
- Console.WriteLine("Сумма второй строки " + sum + ". Произведение первого столбца " + product + ".");
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment