Im doing problem five on Project Euler. Basically, your supposed to find the smallest number that is evenly divided by the numbers from 1-20. heres my code, its just outputting 21, the condition on my loop.
Code:
#include <iostream>
using namespace std;
bool Divisible(int num, int divisor);
int main()
{
int end;
int i = 3;
int I = 2;
while (!Divisible(i,I))
{
i++;
I = 2;
do
{
Divisible(i, I);
if (!Divisible)
I = 21;
else
I++;
}while(I <= 20);
end = i;
}
cout<<end;
}
bool Divisible(int num,int divisor)
{
if (num % divisor == 0)
return true;
else
return false;
}