Hei, I get success in ideone.com
Success #stdin #stdout 0s 131520KB
2
3
4
42
when I give input as
2
3
4
42
below is the program again:
using System;
using System.Collections.Generic;
public class Test
{
public static void Main()
{
List list = new List();
while (true)
{
int n = Convert.ToInt32(Console.ReadLine());
list.Add(n);
if (n == 42)
{
foreach (var item in list)
{
Console.WriteLine(item);
Console.Out.Flush();
}
break;
}
}
}
}