0

Help me with the output please C#

Here int[][] myArray = new int[3][]; myArray[0] = new int[4] { 3, 5, 1, 9 }; myArray[1] = new int[3] { 4, 6, 8 }; myArray[2] = new int[2]; for (int i = 0; i < myArray.Length; i++) { for (int j = 0; j < myArray[i].Length; j++) Console.WriteLine(" [{0}][{1}] = {2}" , i , j , myArray[i][j]); Console.WriteLine(); Console.ReadKey(); }

11th Nov 2021, 8:44 AM
Glory
Glory - avatar
1 ответ
+ 1
Next time please, prefer to share link to the code. https://www.sololearn.com/post/75089/?ref=app using System; namespace JaggedArray { class Practice { static void Main( string[] args ) { int[][] myArray = new int[3][]; myArray[ 0 ] = new int[ 4 ] { 3, 5, 1, 9 }; myArray[ 1 ] = new int[ 3 ] { 4, 6, 8 }; myArray[ 2 ] = new int[ 2 ]; for (int i = 0; i < myArray.Length; i++) { for (int j = 0; j < myArray[i].Length; j++) { Console.WriteLine("myArray [{0}][{1}] = {2}", i , j , myArray[i][j]); } Console.WriteLine(); } } } }
11th Nov 2021, 1:37 PM
Ipang