Correct problem 52 solution
This commit is contained in:
parent
3503357703
commit
5698ab4b77
6
C/p052.c
6
C/p052.c
@ -10,7 +10,7 @@ int have_same_digits(int a, int b);
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, found = 0;
|
int i;
|
||||||
double elapsed;
|
double elapsed;
|
||||||
struct timespec start, end;
|
struct timespec start, end;
|
||||||
|
|
||||||
@ -19,12 +19,12 @@ int main(int argc, char **argv)
|
|||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
/* Brute force approach, try every integer number until the desired one is found.*/
|
/* Brute force approach, try every integer number until the desired one is found.*/
|
||||||
while(!found)
|
while(1)
|
||||||
{
|
{
|
||||||
if(have_same_digits(i, 2*i) && have_same_digits(i, 3*i) && have_same_digits(i, 4*i) &&
|
if(have_same_digits(i, 2*i) && have_same_digits(i, 3*i) && have_same_digits(i, 4*i) &&
|
||||||
have_same_digits(i, 5*i) && have_same_digits(i, 6*i))
|
have_same_digits(i, 5*i) && have_same_digits(i, 6*i))
|
||||||
{
|
{
|
||||||
found = 1;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user