Skip to content

Instantly share code, notes, and snippets.

@kishan-dhankecha
Last active October 13, 2021 04:54
Show Gist options
  • Save kishan-dhankecha/9970b55f69676e9b50d6796d7af51698 to your computer and use it in GitHub Desktop.
Save kishan-dhankecha/9970b55f69676e9b50d6796d7af51698 to your computer and use it in GitHub Desktop.
import 'dart:io';
void main() {
print('PROJECT FROM: https://github.com/Kishan-Dhankecha');
print('--------------------');
//Take the inputs from User
print('Enter the count of column:');
var _column = int.parse('${stdin.readLineSync()}');
print('Enter the count of row:');
var _row = int.parse('${stdin.readLineSync()}');
//Make 3D array
make3dArray(column: _column, row: _row);
//Display 3D array
print('Here is your Array:');
print('--------------------');
array3d.forEach((element) {
print(element);
});
print('--------------------');
}
late List array3d;
void make3dArray({required int column, required int row}) {
array3d = List.generate(row, (i) {
return []..length = column;
});
for (var i = 0; i < row; i++) {
for (var j = 0; j < column; j++) {
array3d[i][j] = '$i,$j';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment