123456789101112131415161718192021222324252627282930313233343536 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SedovaCheskinaProject
- {
- internal class zadacha5
- {
- public void mas()
- {
- Random r = new Random();
- int[,] array = new int[5, 5];
- Console.WriteLine("Данный массив: ");
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- array[i, j] = r.Next(0, 50);
- Console.Write(array[i, j] + " ");
- }
- Console.WriteLine();
- }
- int sum = 0;
- int count = 0;
- foreach (int number in array)
- {
- sum += number;
- count++;
- }
- Console.WriteLine((double)sum / count);
- }
- }
- }
|