Output the number of all the daffodils from 1-10000

Output the number of all the daffodils from 1-10000

Variation of the number of daffodils-Lily Number: Split any number from the middle into two numbers, for example, 1461 can be split into (1 and 461), (14 and 61), (146 and 1), if all are split After the sum of the products is equal to itself, it is a Lily Number.

For example:
655 = 6 * 55 + 65 * 5
1461 = 1 461 + 14 61 + 146*1
Find all Lily Numbers in 5 digits.
The source code is as follows

#include <stdio.h>
int main()
{
int a = 0;
for (int i = 1; i <= 10000; i++)
{
if (i < 100)
{
if (i == (i / 10) * (i % 10))
printf("%d “, i);
}
else if (i >= 100 && i < 1000)
{
if (i == (i / 100) * (i % 100) + (i / 10) * (i % 10))
printf(”%d “, i);
}
else if (i >= 1000 && 1 < 10000)
{
if (i == (i / 1000) * (i % 1000) + (i / 100) * (i % 100) + (i / 10) * (i % 10))
printf(”%d ", i);
}
}
return 0;
}

Guess you like

Origin blog.csdn.net/qq_43745617/article/details/109447936