How to use a simple and rough method to find the number of daffodils in C language
This article mainly introduces the C language how to use a simple and rough method to find the number of daffodils related knowledge, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe that after reading this C language how to use simple and rough methods to find daffodils number articles will have a harvest, let's take a look.
What is the number of daffodils:
Refers to an n-digit number in which the sum of the n-th powers of the numbers is exactly equal to the number itself.
For example:
1 1 ^ 1 = 1
153 3 ^ 3 + 5 ^ 3 + 1 ^ 3 = 153
Problem: find the number of daffodils between 0,100000 and print it out.
Look at the topic and find a breakthrough:
0100000. I can think of using a loop to judge the number between 010000.
As can be seen from Chestnut: we need to ask for a few digits.
To use the power, we need to refer to the pow function in the math library
To sum up, you still have to use a loop.
So start writing code and think about it step by step:
# include # include int main () {int I = 0; for (I = 0; I