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 Korki29
- {
- class Matrix
- {
- public double[,] table { get; set; }
- public Matrix(int x, int y)
- {
- table = new double[x, y];
- FillTable();
- }
- public void FillTable()
- {
- var random = new Random();
- for (int x = 0; x < table.GetLength(0); x++)
- {
- for (int y = 0; y < table.GetLength(1); y++)
- {
- table[x, y] = random.Next(1, 9);
- Console.Write($"{table[x, y]} ");
- }
- Console.WriteLine();
- }
- }
- public void CheckCol()
- {
- var sumy = new List<double>();
- for (int x = 0; x < table.GetLength(1); x++)
- {
- double sum = 0;
- for (int y = 0; y < table.GetLength(0); y++)
- {
- sum += table[y, x];
- }
- Console.WriteLine(sum);
- sumy.Add(sum);
- }
- var result = sumy.Max() / table.GetLength(1);
- Console.WriteLine($"\n{result}");
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- var table = new Matrix(5, 5);
- table.CheckCol();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement