The challenge for this month’s Exercise is to report the angle between two hands on an analog clock. The result must be positive and it must reflect the lesser of two possible degrees.
Continue reading
Category Archives: Solution
Too Big – Solution
This month’s Exercise is about finding the limits, or how large a signed or unsigned char value can get before it flips over to negative or to zero. And the trick is performing this feat in your code without using the defined constants for a char data type available in the limits.h header file.
Continue reading
Ramanujan Nested Radicals – Solution
The topic for this month’s Exercise is to code a recursive function that solves the Ramanujan Nested Radical, illustrated in Figure 1. Remember that Ramanujan created and solved this puzzle in his head. #genius
Continue reading
It’s All Greek! – Solution
As a wrap-up for my ctype questions, this month’s Exercise is to write a ctype function that converts lowercase Greek letters to uppercase and vice-versa. This challenge isn’t a steep hill to climb, once you know the pattern of Unicode Greek letter values, and ignore the required accent and breathing marks that frequently adorn various letters.
Continue reading
That Series That Lacks a Name but Equals 5e – Solution
Once again, I dive into the murky waters of mathematics for this month’s Exercise. The challenge is to code the Series That Has No Name (STHNN), which converges on the value 5e.
Continue reading
Pointers to Multi-Dimension Arrays – Solution
The challenge for this month’s Exercise is to use pointers to work through a multi-dimensional array. As I mentioned in the exercise post, multi-dimensional arrays are all stored as a single-dimension where the compiler calculates offsets for rows and columns (and more) for you.
Continue reading
A Little Bit Off the Sides – Solution
The C language woefully lacks a trim() or similar string manipulation function. Rather than let it flail in absent envy, your task for this month’s Exercise is to code such a function. The goal is to remove whitespace characters from either end of a string.
Continue reading
What is the Largest Value – Solution
Once again, the challenge for this month’s exercise is to unravel a math puzzle. This time, the puzzle reads like this:
Continue reading
Pulling Numbers from a String – Solution
This month’s C programming exercise is to extract numbers from a string. Specifically, your task is to code the extract() function that returns the address of a digit found in a string. This function must also be capable of repeat calls to continue locating digits within the same string.
Continue reading
Is It a “Real” Triangle? – Solution
The challenge for this month’s Exercise is to generate three random values and determine if they work as sides of a valid triangle. To make this determination, you must consider three types of triangles and test the generated values for each.
Continue reading