Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Arrays
- {
- class Program
- {
- static void Main(string[] args)
- {
- int rows = int.Parse(Console.ReadLine());
- int cols = int.Parse(Console.ReadLine());
- int[,] intMatrix = new int[rows, cols];
- for (int row = 0; row < rows; row++)
- {
- for (int col = 0; col < cols; col++)
- {
- intMatrix[row, col] = int.Parse(Console.ReadLine());
- }
- }
- for (int row = 0; row < rows; row++)
- {
- int sum = 0;
- for (int col = 0; col < cols; col++)
- {
- Console.Write(intMatrix[row, col] + " ");
- sum += intMatrix[row, col];
- }
- //сумата на реда
- double average = sum * 1.0 / cols;
- Console.WriteLine(average);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment