using System.Collections.Generic;
public class LinkedListMidpoint
public static void Main()
int[] nums = {5,6,7,8,9};
LinkedList<int> list = new LinkedList<int>(nums);
LinkedListNode<int> slow = list.First;
LinkedListNode<int> fast = list.First;
while (fast != null && fast.Next != null)
int midpoint = slow.Value;
Console.WriteLine("Midpoint of the linked list: " + midpoint);