Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int[,] FillingArray(int n)
- {
- int[,] array = new int[n, n];
- for (int i = 0; i < n; i++)
- for (int j = 0; j < n; j++)
- {
- array[i, j] = (i + j + 1)<=n? (i + j + 1) : 0;
- }
- return array;
- }
- static void ShowArray(int[,] array)
- {
- for (int i = 0; i < array.GetLength(0); i++)
- {
- for (int j = 0; j < array.GetLength(1); j++)
- {
- Console.Write("{0,-3}", array[i, j]);
- }
- Console.WriteLine();
- }
- }
- static void Main()
- {
- int[,] array = FillingArray(10);
- ShowArray(array);
- Console.ReadKey();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement