Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _1._MatrixInputOutput
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int rows = int.Parse(Console.ReadLine());
- int cols = int.Parse(Console.ReadLine());
- int[,] numbers = new int[rows, cols];
- double sum = 0; //сума на елементите
- int count = rows * cols; //брой на елементите
- //input matrix
- for (int row = 0; row <= rows - 1; row++)
- {
- for (int col = 0; col <= cols - 1; col++)
- {
- numbers[row, col] = int.Parse(Console.ReadLine());
- sum += numbers[row, col];
- }
- }
- //средно аритметично
- double average = sum / count;
- Console.WriteLine(average);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment