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;
- namespace БордюговМаксим_10МИ4_2Пара
- {
- class Program
- {
- public static void Mass(ref int[,] N, ref int i, ref int j, int n)
- {
- for (i = 0; i < n; i++)
- {
- for (j = 0; j < n; j++)
- Console.Write("{0,3}",N[i,j]);
- Console.WriteLine();
- }
- }
- public static void MassRandom(ref int[,] N, ref int i, ref int j, int n, ref Random random)
- {
- for (i = 0; i < n; i++)
- for (j = 0; j < n; j++)
- N[i, j] = random.Next(1,11);
- }
- public void Reverse(string str, ref int i, ref char temp, ref int converter)
- {
- Console.WriteLine("Напишите строку которую хотите перевернуть");
- str = Console.ReadLine();
- for (i = 0; i < (str.Length / 2) - 1; i++)
- {
- }
- }
- public static void Diagonal(ref int[,] N, ref int n, ref int i, ref int j, ref int sum, ref Random random)
- {
- N = new int[3, 3];
- Console.WriteLine("Номер строки?");
- n = 1;
- //n = Convert.ToInt32(Console.ReadLine());
- sum = 0;
- MassRandom(ref N, ref i, ref j, 3, ref random);
- Mass(ref N, ref i, ref j, 3);
- for (i = 0; i < 3; i++)
- for (j = 0; j < 3; j++)
- if (i == j)
- if (i + n <= 3 && j + n <= 3)
- {
- sum += N[i , j];
- }
- Console.WriteLine(sum);
- }
- static void Main(string[] args)
- {
- string str = " ";
- char temp = ' ';
- int i = 0;
- int j = 0;
- int converter = 0;
- char k = ' ';
- int[,] N = new int[3,3];
- int n = 0;
- int sum = 0;
- Random random = new Random();
- do
- {
- Diagonal(ref N, ref n, ref i, ref j, ref sum, ref random);
- Console.WriteLine("Для повтора нажмите \"y\"");
- k = Convert.ToChar(Console.ReadLine());
- } while (k == 'y' || k == 'Y');
- Console.WriteLine("Для завершения нажмите любую клавишу");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement