I don't know what is wrong but the program is just not working. I will be really grateful if you help me.
using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
{
LinkedList<ulong> integers = new LinkedList<ulong>();
for(ulong i = 1; i <= 10; i++)
{
integers.AddLast(i);
}
Console.Write("Enter an integer: ");
ulong x = ulong.Parse(Console.ReadLine());
Console.WriteLine();
foreach(ulong integer in integers)
{
if(integer > x)
{
integers.Remove(integer);
}
}
integers.AddLast(x);
integers.AddLast(10);
foreach(ulong integer in integers)
{
Console.WriteLine(integer);
}
}
}
The condition of my task is: Create a LinkedList of 10 positive integers. The finished list is displayed on the screen. Enter a positive integer x on the keyboard, delete all items greater than x from the list, and add an item with a value of 10 after the last item in the x-value list. Display the changed list.