Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use a simple and rough method to find the number of daffodils in C language

2025-04-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report