i have written the following code that is probably full of bugs as i haven't had a chance to test it yet because at compile i get the following warning.

||=== Build: Debug in project 5 (compiler: GNU GCC Compiler) ===|

/home/ben/Documents/project euler/project 5/main.c||In function ‘divide’:|

/home/ben/Documents/project euler/project 5/main.c|42|warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]|

/home/ben/Documents/project euler/project 5/main.c|43|note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’|

||=== Build finished: 0 error(s), 1 warning(s) (0 minute(s), 0 second(s)) ===|

here is the code

Code:

#include <stdio.h>
#include <stdlib.h>
#define MILLION 1000000
int divide(int num, int divisor);
int main()
{
int result, num_divide, max_divisor;
printf("Please enter the max number to divide by: ");
scanf(" %d", &max_divisor);
for (num_divide = max_divisor; num_divide < MILLION; num_divide++)
{
if((result = divide(num_divide, max_divisor)))
{
break;
}
}
if (result == -1)
{
printf("naughty naughty you entered zero you cant divide by zero!\n");
}
else if (result == 1)
{
printf("there is no number between 1 and %d that can be divided by all the integers 1 to %d\n", MILLION, max_divisor);
}
else
{
printf("the smallest number that can be divided by all the integers 1 to %d is %d\n", max_divisor, num_divide);
}
return 0;
}
int divide(int num, int divisor)
{
// sanity checks
if (num == 0); //warning here
{
return - 1;
}
if (num % divisor != 0)
{
return 0;
}
if (divisor == 1)
{
return 1;
}
divide(num, divisor - 1);
}

coop