0% found this document useful (0 votes)
4 views3 pages

6# Array Index

The document contains multiple examples of C# code demonstrating the use of arrays, including initialization, accessing elements, and user input. Each example illustrates different array types such as strings, integers, and floats, along with basic operations like printing and assigning values. The code snippets are organized under a namespace and a main program class.

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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

6# Array Index

The document contains multiple examples of C# code demonstrating the use of arrays, including initialization, accessing elements, and user input. Each example illustrates different array types such as strings, integers, and floats, along with basic operations like printing and assigning values. The code snippets are organized under a namespace and a main program class.

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 DOCX, PDF, TXT or read online on Scribd

Array Index

EXAMPLE 1:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = { "DarKLter", "Lesunter", "KLter" };
float[] grades = { 92.5f, 93.25f, 9623f, 85.75f };
}
}
}

EXAMPLE 2:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = new string[5];
int[] numbers = new int[10];
float[] grades = new float[25];
}
}
}

EXAMPLE 3:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = { "DarKLter", "Lesunter", "KLter", "Karl",
"Lester" };
[Link](names[0]);
[Link](names[1]);
[Link](names[2]);
[Link](names[3]);
[Link](names[4]);
}
}
}
EXAMPLE 4:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
int[] numbers = new int[10];

numbers[0] = 5;
numbers[1] = 10;
numbers[2] = 15;
numbers[3] = 20;
numbers[4] = 25;
numbers[5] = 30;

[Link](numbers[0] + numbers[5]);
}
}
}

EXAMPLE 5:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] names = new string[3];
[Link]("Enter Name : ");

names[0] = [Link]();

[Link]();
[Link]("I am " + names[0]);
}
}
}

EXAMPLE 6:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
float[] grades = new float[3];
grades[2] = [Link]([Link]());

[Link]("English : " + grades[2]);


}
}
}
EXAMPLE 7:

using System;

namespace darklter
{
class Program
{
static void Main(string[] args)
{
int index = 0;
string[] names = { "DarKLter", "Lesunter", "KLter" };

[Link](names[index]);
}
}
}

EXAMPLE 8:

using System;
namespace darklter
{
class Program
{
static void Main(string[] args)
{
string[] emails = new string[4];
emails[0] = "TribalPogiGwapo22@[Link]";
emails[1] = "TribalPogiGwapo33@[Link]";
emails[2] = "TribalPogiGwapo44@[Link]";
emails[3] = "TribalPogiGwapo55@[Link]";

string[] username = new string[4];


username[0] = "DarkGwapo";
username[1] = "Kursoko";
username[2] = "BahoUtot";
username[3] = "BahongTaeKo";

string[] password = new string[4];


password[0] = "11111111";
password[1] = "22222222";
password[2] = "33333333";
password[3] = "44444444";

[Link]("Index : ");
int index = Convert.ToInt32([Link]());

[Link]();
[Link]("Email : " + emails[index]);
[Link]("Username : " + username[index]);
[Link]("Password : " + password[index]);
}
}
}

You might also like