|
//21-masala: Massivni kesishish
|
bet | 4/4 | Sana | 14.05.2024 | Hajmi | 22,12 Kb. | | #232468 |
Bog'liq DASTURIY INJENERING (2)//21-masala: Massivni kesishish
int[] numbers1 = { 10, 20, 30, 40, 50 };
int[] numbers2 = { 30, 40, 50, 60, 70 };
int[] intersected = numbers1.Intersect(numbers2).ToArray();
//22-masala: Massivni farqlash
int[] numbers1 = { 10, 20, 30, 40, 50 };
int[] numbers2 = { 30, 40, 50, 60, 70 };
int[] excepted = numbers1.Except(numbers2).ToArray();
//23-masala: Massivni aylantirish
int[] numbers = { 10, 20, 30, 40, 50 };
Array.Reverse(numbers);
//24-masala: Massivni klonlash
int[] numbers = { 10, 20, 30, 40, 50 };
int[] cloned = (int[])numbers.Clone();
//25-masala: Massivni dictga aylantirish
int[] numbers = { 10, 20, 30, 40, 50 };
Dictionary dict = numbers.ToDictionary(n => n, n => n * n);
|
| |