1 / 2
Jul 2017
static void Main()
{
    int t = int.Parse(Console.ReadLine());
    var inputNumbers = new List<int>();
    var listOfLists = new List<List<int>>();

    while (true)
    {
        while (t != 0)
        {
            inputNumbers = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            listOfLists.Add(inputNumbers);
            t--;
        }

        foreach (var item in listOfLists)
        {
            foreach (var number in item)
            {
                for (int i = number; i <= item.Last(); i++)
                {  
                    if (isPrime(i))
                    {
                        Console.WriteLine(i);
                    }
                }
            }
            Console.WriteLine();
        }
        break;
    }
}
static bool isPrime(int number)
{
    if ((number & 1) == 0)
    {
        return (number == 2);
    }

    int limit = (int)Math.Sqrt(number);

    for (int i = 3; i <= limit; i += 2)
    {
        if ((number % i) == 0)
        {
            return false;
        }
    }
    return true;
}

it does work as expected on vs, but Ideone throws this:

stdin Standard input is empty
stdout Standard output is empty

what do i need to change to fix this?

  • created

    Jul '17
  • last reply

    Jul '18
  • 1

    reply

  • 937

    views

  • 2

    users

1 year later

You would need to provide the stdin in the textbox. Then hit run and you are good to go.