Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

using System;

using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _11Array
{
class Program
{
static void Main(string[] args)
{
int[] arr = {100, 101, 102, 103, 104, 105, 106, 107, 108, 109 };

Console.WriteLine(" Detyra 1 \n");

for (int i = 0; i < arr.Length; i++)


{
Console.WriteLine("Element[" + i + "] = " + arr[i]);
}

Console.WriteLine("\n Detyra 2 \n");

foreach (int i in arr)


{
int index = Array.IndexOf(arr, i);
Console.WriteLine("Element[" + index + "] = " + i);
}

Console.WriteLine("\n Detyra 3 \n");

int[] vals = { 1, 2, 3, 4 };

vals[0] *= 2;
vals[1] *= 2;
vals[2] *= 2;
vals[3] *= 2;

Console.WriteLine("[" + vals[0] + ", " + vals[1] + ", " + vals[2] + ",


" + vals[3] + "]");

Console.WriteLine("\n Detyra 4 \n");

int[,,] arr3D = { { { 12, 2, 8 }, { 14, 5, 2 } }, { { 3, 26, 9 }, { 4,


11, 2 } } };

foreach (int i in arr3D)


{
Console.Write(i + " ");
}

Console.ReadKey();
}
}
}

You might also like