Scala Programming: Find the nth element of a given list
Write a Scala program to find the nth element of a given list.
Sample Solution:
Scala Code:
Sample Output:
Original list: List(10, 20, 30, 40, 50, 70, 90, 110, 140, 120, 160) 3rd element of the said element: 30 6th element of the said element: 70 1st element of the said element: 10
Scala Code Editor :
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Scala program to find the even and odd numbers from a given list.
Next: Write a Scala program to find an element from the last position of a given list.
What is the difficulty level of this exercise?