aaaaaaaaaaaaaaaaa
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{ //int[3, 2] 3 used for Rows and 2 used for Columns.
int[,] arr = new int[3, 2] { { 3, 2 }, { 1, 4 }, { 6, 3 }};
//if U wish use like '{ { 33, 12 }, { 15, 433 },{ 6, 321}};'
int i, j; //it is Ur choice.
for (i = 0; i < 3;i++ ) //Used for Rows.
{
for (j = 0; j < 2; j++ ) //Used for Columns.
{
Console.Write(arr[i, j]);
//You can also write for all row and column printing like
}//'Console.WriteLine("arr[{0}, {1}] = {2}", i, j, arr[i, j]);'.
Console.WriteLine(); //used for going to new line.
}
Console.ReadKey();
} //in this program has 3 Rows and 2 Columns, '3, 1, and 6'
} //is first column and '2,4 and 3 is second column , and
} //'3,2' is first row '1,4' is second and '6,3' is 3rd row.
//If U using string then write like 'String[,] arr = new string[3, 2] {
//{"Bil","al"}, {"Kh","an"}, { "Tor","khel" }};', and if you using char
//then use single quotes like 'char[,] arr = new char[3, 2] { {'B','K'}...'.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
int[,] arr = { { 4, 3, 5, 6, 1 },
{ 8, 7, 6, 5, 7 },{ 5, 3, 6, 8, 2 } };
foreach (int ar in arr)
{ //I write array in 2 lines,U write in 1 line its
Console.WriteLine(ar); //Ur choice.
} //If U wont to print in one line then write like
//'Console.Write(ar);'
Console.ReadKey();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int[,] arr = { { 4, 3, 5, 6, 1 },
{ 8, 7, 6, 5, 7 },
{ 5, 3, 6, 8, 2 } };
int i, j;
for (i = 0; i < 3; i++) //Used for Rows.
{
for (j = 0; j < 5; j++) //Used for Columns.
{ //'arr[i,j]', 'i' used for printing rows and 'j' used
Console.Write(arr[i,j]); //for printing columns.
}
Console.WriteLine();//used for new line.
}
Console.ReadKey();
} //in this program has 3 rows and 5 columns.
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{ //here is 3 rows and 3 columns like 0,1,2.
int[,] arr = new int [3,3]; //if U using string then write
//like 'string[,] arr = new string [3, 3];'.
for (int i = 0; i < 3; i++)
{ //first loop'i' 1 time looping then 2nd'j' 3 time looping.
for (int j = 0; j < 3; j++)
{
arr[i,j] = Int32.Parse (Console.ReadLine());
} //if U use string then write like
//arr[i,j] = Console.ReadLine();
Console.WriteLine(); //used for new line in input time.
}
for (int a = 0; a < 3; a++)
{
for (int b = 0; b < 3; b++)
{
Console.Write(arr[a, b]);
}
Console.WriteLine(); //used for new line in output time.
}
Console.ReadKey();
}
}
}