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 Sn_Bo_6__6_
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Введите размерность матрицы n: ");
- int n = int.Parse(Console.ReadLine());
- int m = n;
- int[][] a = new int[n][];
- for (int i = 0; i < n; ++i)
- {
- a[i] = new int[n];
- for (int j = 0; j < m; ++j)
- {
- Console.Write("a[{0}][{1}]= ", i, j);
- a[i][j] = int.Parse(Console.ReadLine());
- }
- }
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < m; ++j)
- {
- if (a[i][j] % 2 == 0)
- break;
- if(j==m-1)
- {
- for(int k=i;k<n-1;++k)
- {
- for (int l = 0; l < m; ++l)
- {
- a[k][l] = a[k + 1][l];
- }
- }
- --i;
- --n;
- }
- }
- }
- Console.WriteLine("Конечная матрица: ");
- for (int i = 0; i < n; ++i)
- {
- for (int j = 0; j < m; ++j)
- Console.Write("{0} ", a[i][j]);
- Console.WriteLine();
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment