using System.Collections.Generic;
public static void Main()
double[] sales = new double[20];
int[] myScoresV1 = new int[5] {100, 76, 88, 100, 90};
int[] myScoresV2 = new int[] {101, 77, 89, 101, 91};
int[] myScoresV3 = {102, 78, 90, 102, 92};
char[] arrayOfLetters = new char[] {'h', 'e', 'l', 'l', 'o'};
string word = new string(arrayOfLetters);
int[] myScoresExp = {100, 76, 88, 100, 90};
Console.WriteLine("Array size is {0}", myScoresExp.Length);
for (int x = 0; x < myScoresExp.Length; x++)
Console.WriteLine(myScoresExp[x]);
Console.WriteLine("Foreach:");
double[] payRates = {12.00, 17.35, 21.12, 27.45, 32.22};
foreach (double money in payRates)
Console.WriteLine(money.ToString("C"));
int[] validValues = {101, 108, 201, 213, 266, 304, 311, 409, 411, 412};
double[] prices = {0.89, 1.23, 3.50, 0.69, 5.79, 3.19, 0.99, 0.89, 1.26, 8.00};
bool isValidItem = false;
while (y < validValues.Length && itemOrdered != validValues[y])
if (y != validValues.Length)
Console.WriteLine("Item {0} sells for {1}", itemOrdered, itemPrice.ToString("C"));
Console.WriteLine("No such item as {0}", itemOrdered);
int[] discountRangeLowLimits = {1, 13, 50, 100, 200};
double[] discounts = {0, 0.10, 0.14, 0.18, 0.20};
int sub = discountRangeLowLimits.Length - 1;
while (sub >= 0 && numOfItems < discountRangeLowLimits[sub])
customerDiscount = discounts[sub];
Console.WriteLine(customerDiscount);
int[] idNumbers = {122, 167, 204, 219, 345};
int z = Array.BinarySearch(idNumbers, entryID);
Console.WriteLine("Not found");
Console.WriteLine("ID {0} found at position {1}", entryID, z);
string[] names = {"Olive", "Patty", "Richard", "Ned", "Mindy"};
for (q = 0; q < names.Length; q++)
Console.WriteLine(names[q]);
Console.WriteLine("---------- Reverse names: ");
for (q = 0; q < names.Length; q++)
Console.WriteLine(names[q]);
Console.WriteLine("---------- Two-dimensional arrays ");
double[,] shippers = new double[3, 4];
double[,] shippersV2 = {{14.00, 15.00, 16.00, 17.00},
{21.99, 34.55, 67.88, 31.99},
{12.03, 55.55, 32.89, 1.17}};
int[,] rents = {{400, 450, 510},
Console.WriteLine("Enter the floor on which you want to live: ");
Console.WriteLine("Enter the number of bedrooms you need: ");
Console.WriteLine("The rent is {0}", rents[floor, bedrooms]);
int[,,] builds = {{{400, 500}, {450, 550}, {500, 550}},
{{510, 610}, {710, 810}, {910, 1010}},
{{525, 625}, {725, 825}, {925, 1025}},
{{850, 950}, {1050, 1150}, {1250, 1350}}};
Console.WriteLine(builds[1, 0, 1]);
double[][] tickets = {new double[] {5.50, 6.75, 7.95, 9.00, 12.00, 13.00, 14.50, 17.00, 19.00, 20.25},
new double[] {5.00, 6.00},
new double[] {7.50, 9.00, 9.95, 12.00, 13.00, 14.00},
new double[] {3.50, 6.45, 9.95, 10.00, 12.75},
new double[] {15.00, 16.00}};
Console.WriteLine("{0} and {1}", tickets[route][stop], tickets[2][3]);
Console.WriteLine(tickets[route][stop] + tickets[2][3]);
int[,] series = {{2, 3, 9}, {4, 5, 9}};
for (int i = 0; i < series.GetLength(0); i++)
Console.Write("row {0} : ", i);
for(int j = 0; j < series.GetLength(1); j++)
Console.Write("col{0} ", j);
int[][] jaggedArray = {new int[] {1, 3, 5},
for (int i = 0; i < jaggedArray.Length; i++)
Console.Write("Element of {0} : ", i);
for (int j = 0; j < jaggedArray[i].Length; j++)
Console.Write(jaggedArray[i][j] + ", ");
int[][,] jaggedArrayTwoD = {new int[,] {{1, 8}, {6, 7}},
new int[,] {{0, 3}, {5, 6}, {9, 10}},
new int[,] {{11, 23}, {100, 88}, {0, 10}}
Console.WriteLine(jaggedArrayTwoD[2][0, 1]);
Console.WriteLine("---------- ");
char[] gender = {'m', 'f', 'm', 'm', 'm', 'f', 'f', 'm', 'm', 'm', 'f'};
int male = 0, female = 0;
foreach (char g in gender)
Console.WriteLine("Male: {0}, Female: {1}", male, female);
Console.WriteLine(" List (Collection)");
var numList = new List<int>() {5, -8, 3, 14, 9, 17, 0, 4};
foreach(int n in numList)