Is my program taking too much time to execute?
- by Conrad C
I wanted to solve a question from project euleur about finding the largest prime number of a big number. I run my code on a virtual machine on Visual studio 2012, and the code seems froze. When I step into the loop, the code works well, but when I execute it, the console is always there. It is as if the program is still running. Could it be that the program takes time to execute?
My Code
static void Main(string[] args)
{
long number = 5;
for (long i = 1; i < 600851475143; i++)
{
if (i % 2 != 0 && i % 1 == 0 && i % i == 0)
number = i;
}
}