Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //C#
- List<int> elements = new List<int>() { 10, 20, 31, 40 };
- // ... Find index of first odd element.
- int oddIndex = elements.FindIndex(x => x % 2 != 0);
- Console.WriteLine(oddIndex);
- //C++
- Vector<int> elements = { 10, 20, 31, 40 };
- int oddIndex = elements.findIndex(begin, end, [](int x) {return x % 2 != 0});
- cout << oddIndex << endl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement