I recently flipped through the "C program design" textbook by Mr. Tan haoqiang and made some exercises by the way. This book is a course material for undergraduate students, so when I look at it, there is a feeling of seeing old friends. Below I will write down some interesting questions and programs for your needs.
1. Find "Sn = a + aa + aaa +... + Aa... A "value, where a is a number, n is the number of items, and a and n are input by the keyboard.
2. Output all "Daffodils ". The so-called "Daffodils" refers to a three-digit number. The cubes of all its numbers are equal to the numbers themselves.
3. If a number is equal to the sum of its factors, this number is called "complete number ". For example, 6 is a factor of 1, 2, 3, and 6 is 1 + 2 + 3. Therefore, 6 is a "complete number ". Program to find all "completions" within 1000 ".
4. output the Yang Hui triangle.
5. Use recursion to convert an integer n into a string. For example, if you enter 483, the "483" character string should be output ". N digits are not fixed.
6. There are n integers, so that the numbers above are moved backward to m positions, and the last number of m is changed to the first number of m.
7. There are n people in a circle with sequential troubleshooting. When the first person reports the number (from 1 to 3), the person who reports the number 3 leaves the circle and asks the last person who left the number.
8. Compile a function to compare two strings and write a strcmp function.
9. Compile a function alloc () to create a continuous space (n characters) in the memory area ).
From the blog of Zhao Xiong