//9-masala: Massivdan ma'lum bir elementni o'chirish
int[] numbers = { 10, 20, 30, 40, 50 };
int indexToRemove = 2;
Array.Clear(numbers, indexToRemove, 1);
//10-masala: Massivni ikkita massivga bo'lish
int[] numbers = { 10, 20, 30, 40, 50 };
int mid = numbers.Length / 2;
int[] firstHalf = numbers.Take(mid).ToArray();
int[] secondHalf = numbers.Skip(mid).ToArray();
//11-masala: Massivni qo'shish
int[] numbers1 = { 10, 20, 30 };
int[] numbers2 = { 40, 50, 60 };
int[] combined = numbers1.Concat(numbers2).ToArray();
//12-masala: Massivni ajratish
int[] numbers = { 10, 20, 30, 40, 50, 60 };
int chunkSize = 2;
var chunks = numbers.Chunk(chunkSize);
//13-masala: Massivni to'ldirish
int[] numbers = new int[5];
numbers.Fill(10);
//14-masala: Massivni filtrlash
int[] numbers = { 10, 20, 30, 40, 50 };
int[] filtered = numbers.Where(n => n % 2 == 0).ToArray();
//15-masala: Massivni proyeksiyalash
int[] numbers = { 10, 20, 30, 40, 50 };
string[] projected = numbers.Select(n => n.ToString()).ToArray();
//16-masala: Massivni kamaytirish
int[] numbers = { 10, 20, 30, 40, 50 };
int total = numbers.Aggregate((a, b) => a + b);
//17-masala: Massivda dublikatlarni olib tashlash
int[] numbers = { 10, 20, 30, 40, 50, 10, 20 };
int[] distinct = numbers.Distinct().ToArray();
//18-masala: Massivni tartiblash (maxsus tartiblash)
int[] numbers = { 10, 20, 30, 40, 50 };
Array.Sort(numbers, (a, b) => b - a);
//19-masala: Massivni guruhlash
int[] numbers = { 10, 20, 30, 40, 50, 60 };
var grouped = numbers.GroupBy(n => n % 2);
//20-masala: Massivni birlashtirish
int[] numbers1 = { 10, 20, 30 };
int[] numbers2 = { 40, 50, 60 };
int[] merged = numbers1.Union(numbers2).ToArray();
|