Category >
CSHARP
|| Published on :
Monday, November 2, 2020 || Views:
669
||
print jagged array find the number of rows and number of columns in each row
Here Pawan Kumar will explain how to print jagged array and also find the number of rows and number of columns in each row
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication7
{
class Demo
{
static void Main(string[] args)
{
int[][] a = new int[2][];
a[0] = new int[] { 89,94,46,54,64 };
a[1] = new int[] {12,56};
for (int i = 0; i < a.Length; i++)
{
for (int j = 0; j < a[i].Length;j++)
Console.Write(" " + a[i][j]);
Console.WriteLine();
}
Console.WriteLine("no of rows=" +a.Length);
Console.WriteLine("no of column in first row=" + a[0].Length);
Console.WriteLine("no of column in second row=" + a[1].Length);
Console.WriteLine("\npress any key to exit");
Console.ReadLine();
}
}
}