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;
- using System.Threading.Tasks;
- namespace ConsoleApp1._8
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rnd = new Random();
- List<List<int>> array = new List<List<int>>(10);
- for (int i = 0; i < 10; i++)
- {
- array.Add(new List<int>(10));
- for (int j = 0; j < 10; j++)
- {
- array[i].Add(rnd.Next(-100, 100));
- if (array[i][j] == 0)
- {
- array[i][j] = 1;
- }
- }
- }
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- Console.Write(array[i][j] + "\t ");
- }
- Console.WriteLine();
- }
- var summ = Math.Abs(array[0][0]) + Math.Abs(array[0][1]) + Math.Abs(array[array.Count-1][array[array.Count-1].Count-1]);
- Console.WriteLine();
- for (int i = 0; i < array.Count; i++)
- {
- for (int j = 0; j < array[i].Count; j++)
- {
- if(summ % array[i][j] == 0)
- {
- Console.WriteLine("Делитель :" + array[i][j]);
- array.Insert(i + 1, new List<int>(10));
- for (int c = 0; c < array[i].Count; c++)
- {
- array[i + 1].Add(0);
- }
- i++;
- break;
- }
- }
- }
- for (int i = 0; i < array.Count; i++)
- {
- for (int j = 0; j < array[i].Count; j++)
- {
- Console.Write(array[i][j] + "\t ");
- }
- Console.WriteLine();
- }
- Console.WriteLine("Делимая сумма: " + summ);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement