Website and domain for sale: mail@discussmain.com

Napissat the program in a programming language.

326
Here so even using System is more correct; using System. Collections. Generic; using System. Linq; using System. Text; namespace NoNamespace {internal static class Program { private static void Main () { Console. WriteLine ("Enter n and m "); var n = int. Parse (Console. ReadLine ()); var m = int. Parse (Console. ReadLine ()); if ((n & lt; = 0) | | (m & lt; = 0))) return; var r = new Random (DateTime. Now. Millisecond); Console. WriteLine (@ "Task1 "); var a = new int[n]. ChangeEach (x = & gt; r. Next(100)); Console. WriteLine (a. Print); Console. WriteLine (. Where (x = & gt; x%2 = = 1). Print ()); Console. WriteLine (); Console. WriteLine (@ "Task2 "); var b = new int [n, m]. ChangeEach (x = & gt; r. Next(-100, 100)); Console. WriteLine (b. Print); Console. WriteLine (Task2(b). Print ()); Console. WriteLine (); Console. WriteLine (@ "Task3 "); Console. WriteLine (b. Print); Console. WriteLine (b. Where (x = & gt; (x ; 0) & amp; & amp; (Math. Abs (x%2) = = 1)). Print ()); Console. WriteLine (); Console. ReadLine (); } private static int [] Task2 (int [] a) { var max =. MaxIndex ((x, y) = & gt; x ; y); var maxv = a [max. Item1, max. Item2]; a [max. Item1, max. Item2] = a [0, 0]; [0, 0] = maxv; return a; } } public static class Extensions { public static List< T> Where< T> (this T [] array, Func< T, bool> filter) { if (filter = = null) return null; var list = new List< T> (); for (var i = 0; i ; array. GetLength(1); i ++) for (var j = 0; j & lt; array. GetLength(0); j ++) if (filter (array [i, j])) list. Add (array [i, j]); return list; } public static string Print< T> (this IEnumerable< T> a) { var enumerable = as IList< T>??. ToList (); if (! enumerable. There is no Any ()) return "Such elements "; var sb = new StringBuilder ("Massif: "); foreach (var ae in enumerable) sb. Append ($\" {ae} "); return sb. ToString (); } public static T [] ChangeEach< T> (this T [] array, Func< T, T> mutator) { if (mutator = = null) return array; for (var i = 0; i ; array. GetLength(1); i ++) for (var j = 0; j & lt; array. GetLength(0); j ++) array [i, j] = mutator (array [i, j]); return array; } public static T [] ChangeEach< T> (this T [] array, Func< T, T> mutator) { if (mutator = = null) return array; for (var j = 0; j & lt; array. GetLength(0); j ++) array[j] = mutator (array[j]); return array; } public static string Print< T> (this T [] a) { return "Do not have if (a. LongLength = = 0) such elements "; var sb = new StringBuilder ("Matrix: n"); for (var i = 0; i ;. GetLength (1); i ++) { for (var j = 0; j & lt;. GetLength (0); j ++) sb. Append ($\" {a [i, j] } "); sb. AppendLine (); } return sb. ToString (); } public static Tuple< int, int> MaxIndex< T> (this T [] array, Func< T, T, bool> comparer) { if (comparer = = null) return new Tuple< int, int> (-1,-1); var index = new Tuple< int, int> (0, 0); for (var i = 0; i ; array. GetLength(1); i ++) for (var j = 0; j & lt; array. GetLength(0); j ++) if (comparer (array [i, j], array [index. Item1, index. Item2])) index = new Tuple< int, int> (i, j); return index; } } }
385
Answer add