0

I am trying to solve a problem 3 on project euler.

For thoes who don´t know the site, here is the question I am trying to solve:

The prime factors of 13195 are 5, 7, 13 and 29.

## What is the largest prime factor of the number 600851475143 ?

And here is the code:

```
#include <stdio.h>
#include <stdlib.h>
#define NUMBER 13195 // Largest prime under this.
int main()
{
int isprime = 1;
unsigned long c, d, biggest; // C=CURRENT number testing if prime. D=DIVIDER (tester).
for (c = 2; c < 13195; c++) {
isprime = 1;
for (d = 2; d < c; d++) {
if (d % c == 0) // I have treid c % d too.
isprime = 0;
}
if (isprime == 1)
biggest = c;
}
printf("%lu", biggest);
return EXIT_SUCCESS;
}
```

This looks pretty strait forward to me, and I can´t see what would be wrong here.

The output is: 13194

And of course i would expect: 29. I am sorry if this is a double post of some sort, or a simple mistake I have overlooked. (I don´t have spell check on my browser at work, so sorry for that too) :)