print a matrix using multidmensional array

Ddd
Posted by Ddd under C# category on | Points: 40 | Views : 4184
using System;

class mul
{
static void Main()
{
int r,c;
Console.WriteLine("enter number of rows");
r=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("enter number of columns");
c=Convert.ToInt32(Console.ReadLine());
int[,] mularr=new int[r,c];
Console.WriteLine("enter array data");
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
mularr[i,j]=Convert.ToInt32(Console.ReadLine());
}
}
Console.WriteLine("this is the matrix");
for(int i=0;i<r;i++)
{
for(int j=0;j<c;j++)
{
Console.Write(mularr[i,j]+"\t");
}
Console.WriteLine();
}
}
}

Comments or Responses

Login to post response