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 ConsoleApp54
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] ar =
- {
- {1,2,3,4,5},
- {6,7,8,9,10},
- {11,12,13,14,15},
- {16,17,18,19,20},
- {21,22,23,24,25}
- };
- KanzasCityShuflya(ar);
- for( int i=0;i<5;i++)
- {
- for(int j=0;j<5;j++)
- {
- Console.Write(ar[i, j]);
- if(ar[i, j]<10)
- {
- Console.Write(' ');
- }
- Console.Write('|');
- }
- Console.WriteLine();
- }
- }
- static void KanzasCityShuflya(int[,]ar)
- {
- int chang = 0;
- int rememb = 0;
- Random rnd1 = new Random();
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- chang = rnd1.Next(5);
- rememb = ar[i,j];
- ar[i, j] = ar[i, chang];
- ar[i, chang] = rememb;
- }
- }
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- chang = rnd1.Next(5);
- rememb = ar[j, i];
- ar[j, i] = ar[chang, i];
- ar[chang, i] = rememb;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement