In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what are the classic algorithms in C language". The explanation in this article is simple and clear, easy to learn and understand. Please follow the ideas of Xiaobian and go deep into it slowly to study and learn "what are the classic algorithms in C language" together.
(1)Output 9*9 multiplication formula
Run Results:
(2)Print out all the "daffodils,"
The so-called "narcissus number" refers to a three-digit number, the cube sum of each digit is equal to the number itself. For example: 153 is a "daffodil number" because 153=1 to the third power +5 to the third power +3 to the third power
Program analysis: the use of for loop control 100-999 number, each number decomposed into units, tens, hundreds.
(3)Programming Print Yang Hui Triangle
Run Results:
(4)A ball falls freely from a height of 100 meters, jumping back to half its original height after each landing; and then falls again, how many meters does it pass when it lands on the 10th landing? How high is the 10th bounce?
Program source code:
(5)A monkey picks N peaches, eats half of them the first day, eats one more, and eats the rest the next day.
Half ate an extra one, and on the tenth day there was one more.
Program source code:
(6)To achieve the input string reverse order output.
Run Results:
(7)Divide a positive integer into prime factors. For example: input 90, print 90=2*3*3*5
Program analysis: n decomposition prime factor, should first find a minimum prime k, and then according to the following steps
Cheng:
1. If this prime number is exactly equal to n, it means that the process of decomposing prime factors has ended and can be printed.
If nk, but n is divisible by k, print the value of k and divide n by the quotient of k as the new positive.
Repeat step 1 for the integer n.
If n is not divisible by k, repeat the first step with k+1 as the value of k.
Program source code:
(8)A 4×4 array is rotated counterclockwise by 90 degrees and output. The data of the original array is required to be input randomly. The new array is output in 4 rows and 4 columns.
Run Results:
(9)Enter two positive integers m and n and find their greatest common divisor and least common multiple.
Program source code:
Want to become an excellent, capable programmer, do software development, then come to learn C/C++ bar, and learn programming, then there is a learning atmosphere and communication circle is particularly important! Here I recommend a C language C++ communication button skirt, --first 8709; after 63251, whether you are Daniel or Xiaobai, we all grow and progress together.
(10)Input a line of characters, respectively count out the number of English letters, spaces, numbers and other characters
Program analysis: use while statement, conditional on the input character is not ' '.
Thank you for reading, the above is the "C language in the classic algorithm what" content, after the study of this article, I believe that we have a deeper understanding of the C language in the classic algorithm what this problem, the specific use of the situation also needs to be verified by practice. Here is, Xiaobian will push more articles related to knowledge points for everyone, welcome to pay attention!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.