Is my program taking too much time to execute?
Posted
by
Conrad C
on Stack Overflow
See other posts from Stack Overflow
or by Conrad C
Published on 2012-11-08T04:41:19Z
Indexed on
2012/11/08
5:01 UTC
Read the original article
Hit count: 225
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;
}
}
© Stack Overflow or respective owner