Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] mas = new int[10, 10];
- Random Gen = new Random();
- int i = 0;
- do
- {
- int j = 0;
- do
- {
- mas[i, j] = Gen.Next(0, 100);
- j++;
- } while (mas.GetLength(1) > j);
- i++;
- } while (mas.GetLength(0) > i);
- Console.WriteLine("\t\t\t\tЭлементы массива");
- i = 0;
- do
- {
- int j = 0;
- do
- {
- Console.Write("{0,8}", mas[i, j]);
- j++;
- } while (mas.GetLength(1) > j);
- i++;
- Console.WriteLine();
- } while (mas.GetLength(0) > i);
- int сумма = 0;
- i = 0;
- do
- {
- int j = 0;
- do
- {
- сумма += mas[i, j];
- j++;
- } while (mas.GetLength(1) > j);
- i++;
- } while (mas.GetLength(0) > i);
- Console.WriteLine("Сумма элементов массива = {0}", сумма);
- int[] maxNumbers = new int[10];
- for (i = 0; i < mas.GetLength(0); i++)
- {
- for (int j = 0; j < mas.GetLength(1); j++)
- {
- if (maxNumbers[i] < mas[i, j])
- {
- maxNumbers[i] = mas[i, j];
- }
- }
- }
- foreach (var maxNumber in maxNumbers)
- {
- Console.WriteLine(maxNumber);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement