Traditional Culture Encyclopedia - Traditional festivals - Brothers, help! Solution algorithm, plus traditional flow chart. 1. Determine whether an integer is a prime number?
Brothers, help! Solution algorithm, plus traditional flow chart. 1. Determine whether an integer is a prime number?
1, that is, through screening. LoOK at the cycle, the multiples of a prime number in a certain range are all eliminated, and the cycle is ok at the end. (Note that it is best to use Boolean array storage)
2. Store the first number in a variable, then cycle from the second number to the tenth number, and then compare. If there is a number greater than the number stored in the variable, you can assign it to the variable. You can also sort these ten numbers by sorting, such as bubbling, fast and merging.
4. It must be carried out circularly, but the difficulty lies in how to judge leap years. The number of years over the years can be divisible by four, which is a leap year; Divided by 100 but not divided by 400 is an average year; Leap years can be divisible by 100 or 400.
Specifically, you can hi me.
- Previous article:What are the positions in League of Legends?
- Next article:Why Hunan people call Jiangxi people old table
- Related articles
- Three delicious dishes of Beijing roast duck
- Seeking the Collection of Ancient Female Jewelry in China
- What is the principle of electric light emitting? What about fluorescent lamps and energy saving lamps
- Construction organization design of ancient buildings?
- The Service Purpose of Qiqihar Talent Network
- How about an electric toothbrush? What's the difference with traditional toothbrushes?
- Introduction of Baoding one-day tour route
- Elements of Chinese home decoration
- On the methods of improving the expressive force of broadcast host language
- What does ancient lotus seed soup mean?