Challenge: Fill a 2D Array
Task
Your task create a 3x2 2D array of integers named matrix
and fill it with elements which have the value of equal to i + j
, where i
is the row index, and j
is the column index. Use two for loops with the loop variables named i
and j
to iterate over its indices.
Main.java
123456789101112object Main { def main(args: Array[String]): Unit = { var ___ = Array.___[___](___, ___) // Create a 3x2 2D array for (___ ___ matrix.___) { // Iterate over the row indices for (___ ___ matrix(___).___) { // Iterate over the columns indices matrix(___)(___) = ___ // Assign the sum of indices to the current element print(matrix(___)(___) + " ") } println() } } }
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 4. Розділ 6
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Awesome!
Completion rate improved to 2.86
Challenge: Fill a 2D Array
Свайпніть щоб показати меню
Task
Your task create a 3x2 2D array of integers named matrix
and fill it with elements which have the value of equal to i + j
, where i
is the row index, and j
is the column index. Use two for loops with the loop variables named i
and j
to iterate over its indices.
Main.java
123456789101112object Main { def main(args: Array[String]): Unit = { var ___ = Array.___[___](___, ___) // Create a 3x2 2D array for (___ ___ matrix.___) { // Iterate over the row indices for (___ ___ matrix(___).___) { // Iterate over the columns indices matrix(___)(___) = ___ // Assign the sum of indices to the current element print(matrix(___)(___) + " ") } println() } } }
Все було зрозуміло?
Дякуємо за ваш відгук!
Секція 4. Розділ 6