Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace test
- {
- class Program
- {
- static void Change (ref int[,] ar, ref int n, ref int[] x)
- {
- for (int j = 0; j < n; j++)
- if ((j + 1) % 2 == 0)
- for (int i = 0; i < n; i++)
- ar [i,j] = x[i];
- }
- static void Main()
- {
- int[,] array;
- Console.Write ("n = ");
- int n = int.Parse (Console.ReadLine ());
- array = new int[n, n];
- for (int i = 0; i < n; i++) {
- string[] s = Console.ReadLine ().Split (' ');
- for (int j = 0; j < n; j++)
- array [i, j] = Int32.Parse (s [j]);
- }
- Console.Write ("Enter X = ");
- string[] a = Console.ReadLine ().Split(' ');
- int [] x;
- x = new int[n];
- for (int i = 0; i < n; i++)
- x [i] = Int32.Parse (a [i]);
- Change (ref array, ref n, ref x);
- for (int i = 0; i < n; i++) {
- for (int j = 0; j < n; j++)
- Console.Write ("{0} ", array [i, j]);
- Console.WriteLine ();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment