Your task for this month’s Exercise is to write a program that outputs a value in any base, between 2 and 10. Sure, you can use this code to communicate with alien species that use a base other than decimal, but this benefit is only a happy coincidence to the exercise.
Continue reading
Category Archives: Solution
Formatting a Series for Output – Solution
The challenge for this month’s Exercise is to output a series of numbers, 1 through 10, and to ensure that the final number doesn’t look dorky. I’m certain that’s what I asked for.
Continue reading
Keep Finding That String – Solution
The task for this month’s Exercise is to repeatedly call the strstr() function, locating all instances of one string (“needle”) inside another (“haystack”). Obviously your first task, which also helps with the solution, is to perform error checking on the return value from the strstr() function.
Continue reading
Testing Your Pointer Prowess – Solution
The solution for this month’s Exercise is to output the string "I am an excellent C programmer"
. This task isn’t so simple when you must untie the knot of the dratted double pointer.
Continue reading
Emulating the Modulus Operator – Solution
In an alternative universe, the C programming language lacks a modulus operator and no companion function exists in the library. What to do! Why, you code your own modulus function, which is the challenge for this month’s Exercise.
Continue reading
The Double Factorial – Solution
This month’s Exercise is to write code to calculate a double factorial, which uses the !! notation. A double factorial works like a factorial, but uses only odd or even values based on the parity of the starting value.
Continue reading
Ethiopian Multiplication – Solution
The challenge for this month’s Exercise is to write code that uses the Ethiopian Multiplication method. The process involves doubling and halving the factors, then eliminating and finally tallying the result.
Continue reading
Multiplying Matrixes – Solution
My solution for this month’s Exercise relies upon the solution from last month’s Exercise, specifically the way the matrixes are presented in the main() function and the use of the output() function. What I added is the multiply() function, which multiplies the two matrixes.
Continue reading
Describing Complex Data – Solution
In the C language, a structure is used to express complex data types. The structure contains members that describe different parts of this complex data, such as a matrix required in this month’s Exercise.
Continue reading
The Seventh Line – Solution
This month’s programming Exercise isn’t as much about file access as it’s about dealing with a situation when no data is available. The task: Read the seventh line from a file.
Continue reading