What's wrong with my code? It gives seemingly correct answer on ideone but wrong answer when submiting.
spoj.com/problems/PRIME1/
using System;
public class Test
{
public static void Main()
{
int t, m, n;
t = int.Parse(Console.ReadLine());
for(int i = 0; i < t; i++)
{
string[] temp = Console.ReadLine().Split(' ');
m = int.Parse(temp[0]);
n = int.Parse(temp[1]);
for(int g = m; g <= n; g++)
{
int count = 0;
for (int h = 2; h <= 9; h++)
{
if (g % h == 0 && g != h)
{
count++;
}
}
if (count == 0 && g != 1)
{
Console.WriteLine(g);
}
}
Console.WriteLine();
}
}
}