// Adrians Zemturis // Grupa: 110 // PR: 5.0 // Kompilators: Visual Studio Community 2022 // 2D MASIVS using System; using System.Drawing.Printing; namespace PLAYGROUND { public class Program { static void Main() { int[,] totally_3d_array = { {1, 2, 3, 4}, {5, 6, 7, 8}, {10, 11, 12, 13} }; for (int i = 0; i < totally_3d_array.GetLength(0); i++) { for (int jake = 0; jake < totally_3d_array.GetLength(1); jake++) { Console.Write($"{totally_3d_array[i, jake]}\t"); } Console.WriteLine(); } // RINDU ROBOTS Console.WriteLine("\n2D ROBOTS\n"); int[][] totally_3d_array2 = { new int[]{1, 2, 3, 4}, new int[]{5, 6, 7, 9, 300, 8}, new int[]{10} }; for (int i = 0; i < totally_3d_array2.GetLength(0); i++) { for (int jake = 0; jake < totally_3d_array2[i].Length; jake++) { Console.Write($"{totally_3d_array2[i][jake]}\t"); } } Console.WriteLine(); // RINDU SUMMA Console.WriteLine("\n2D RINDU SUMMA\n"); int[,] totally_3d_array3 = { {4, 4, 4, 4, 4}, {3, 3, 3, 3, 3}, {2, 2, 2, 2, 2}, {1, 1, 1, 1, 1} }; for (int i = 0; i < totally_3d_array3.GetLength(0); i++) { int sum = 0; for (int jake = 0; jake < totally_3d_array3.GetLength(1); jake++) { sum += totally_3d_array3[i, jake]; } Console.WriteLine($"{sum}"); } // Robotais Masīvs – Elementa Meklēšana: Console.WriteLine("\nRobotais Masīvs – Elementa Meklēšana:\n"); int[][] totally_3d_array4 = { new int[]{12, 2048, 1, -69420, 8008}, new int[]{67, 21, 69, 420, 360}, new int[]{11, 2, 3, 4, 5}, }; Console.WriteLine("Ievadiet numerikalu ciparu, kas ir mazāks par 2,147,483,648, un lielaks par -2,147,483,647: "); int user_num = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < totally_3d_array4.GetLength(0); i++) { for (int jake = 0; jake < totally_3d_array4[i].Length; jake++) { if (totally_3d_array4[i][jake] == user_num) { Console.WriteLine($"Rinda: {i} Kolona: {jake}"); break; } } } Console.WriteLine($"Nav"); // Robotais Masīvs – Rindu Sakārtošana: Console.WriteLine("\n Robotais Masīvs – Rindu Sakārtošana:\n"); int[][] totally_3d_array5 = { new int[]{-1, 5, 4, -2, 10}, new int[]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0}, }; for (int i = 0; i < totally_3d_array5.GetLength(0); i++) { Array.Sort(totally_3d_array5[i]); } for (int i = 0; i < totally_3d_array5.GetLength(0); i++) { for (int jake = 0; jake < totally_3d_array5[i].Length; jake++) { Console.Write($"{totally_3d_array5[i][jake]}\t"); } Console.WriteLine(); } // ĻOTI GRŪTS, NAV OBLIGĀTS. PILDAM TIKAI JA SAPROTAM Console.WriteLine("\nlOTI GRuTS, NAV OBLIGaTS. PILDAM TIKAI JA SAPROTAM!!!\n"); int[,] totally_massive_array = { {1, 2, 3, 4}, {2, 3, 4, 5}, }; int[,] parveidots_masivs = new int[totally_massive_array.GetLength(1), totally_massive_array.GetLength(0)]; for (int i = 0; i < totally_massive_array.GetLength(1); i++) { for (int jake = totally_massive_array.GetLength(0) - 1; jake >= 0; jake--) { parveidots_masivs[i, (totally_massive_array.GetLength(0) - 1) -jake] = totally_massive_array[jake, i]; } } for (int i = 0; i < parveidots_masivs.GetLength(0); i++) { for (int jake = 0; jake < parveidots_masivs.GetLength(1); jake++) { Console.Write($"{parveidots_masivs[i, jake]}\t"); } Console.WriteLine(); } } } }