using System;
public class Program
{
static void printMatrix(int[][] matrix) {
int rows = matrix.Length;
for (int i = 0; i < rows; i++) {
int cols = matrix[i].Length;
for (int j = 0; j < cols; j++) {
Console.Write(matrix[i][j] + " ");
}
Console.WriteLine();
}
}
public static void Main(string[] args)
{
int[][] jaggedMatrix = new int[3][];
jaggedMatrix[0] = new int[] { 1, 2, 3 };
jaggedMatrix[1] = new int[] { 4, 5 };
jaggedMatrix[2] = new int[] { 6, 7, 8, 9 };
printMatrix(jaggedMatrix);
}
}
/*
run:
1 2 3
4 5
6 7 8 9
*/