0% found this document useful (0 votes)
9 views5 pages

12# 2D Arrays + NESTED For Loop Getlength

Uploaded by

Lesunter KLter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views5 pages

12# 2D Arrays + NESTED For Loop Getlength

Uploaded by

Lesunter KLter
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

12# 2D Arrays + NESTED For Loop getLength()

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","mercury"},
{"Alenere","alenere123","jupiter"},
{"Hezel","hezel123","saturn"},
{"Jaymar","jarmar123","mars"}
};
Console.WriteLine(users[0, 2]);
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users = new string[4, 2];
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","mercury"},
{"Alenere","alenere123","jupiter"},
{"Hezel","hezel123","saturn"},
{"Jaymar","jarmar123","mars"}
};
users[0, 0] = "Ace";
Console.WriteLine(users[0, 0]);
}
}
}
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
for (int i = 0; i < 5; i++)
{
Console.WriteLine("LOOP " + i);
for (int x = 0; x < 5; x++)
{
Console.WriteLine(x);
}
Console.WriteLine();
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","mercury"},
{"Alenere","alenere123","jupiter"},
{"Hezel","hezel123","saturn"},
{"Jaymar","jarmar123","mars"}
};
Console.WriteLine(users.GetLength(0));
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123"},
{"Alenere","alenere123"},
{"Hezel","hezel123"},
{"Jaymar","jarmar123"}
};
for (int row = 0; row < users.GetLength(0); row++)
{
Console.WriteLine(row);
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123"},
{"Alenere","alenere123"},
{"Hezel","hezel123"},
{"Jaymar","jarmar123"}
};
for (int row = 0; row < users.GetLength(0); row++)
{
for (int col = 0; col < users.GetLength(1); col++)
{
Console.WriteLine(row + " " + col);
}
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","Mars"},
{"Alenere","alenere123","Venus"},
{"Hezel","hezel123","Jupiter"},
{"Jaymar","jarmar123","Saturn"}
};
for (int row = 0; row < users.GetLength(0); row++)
{
for (int col = 0; col < users.GetLength(1); col++)
{
Console.WriteLine(users[row, col]);
}
Console.WriteLine();
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","Mars"},
{"Alenere","alenere123","Venus"},
{"Hezel","hezel123","Jupiter"},
{"Jaymar","jarmar123","Saturn"}
};

int i = 1;

foreach (string x in users)


{
Console.WriteLine(x);
if (i % 3 == 0) Console.WriteLine();
i++;
}
}
}
}

|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|||||||||||||||||||||||||||||||||||||||||||

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[,] users =
{
{"David","david123","Mars"},
{"Alenere","alenere123","Venus"},
{"Hezel","hezel123","Jupiter"},
{"Jaymar","jarmar123","Saturn"}
};

int i = 1;
foreach (string x in users)
{
Console.WriteLine(x);
if (i % users.GetLength(1) == 0) Console.WriteLine();
i++;
}
}
}
}

You might also like