Reading an analog clock is a skill that some kids need to master these days. Oh, I’m sure that eventually everyone figures it out. When I was a kid, digital clocks were rare. No, we all learned how to tell time by looking at a round disk with 12 numbers and a big hand and a little hand. If a second hand was available, well it was just more entertainment for the terminally bored child.
Continue reading
Category Archives: Exercise
Too Big
Difficulty: ★ ★ ☆ ☆
The C language comes with a variety of data types that hold integer (whole number) values. But each type is limited by its size. The issue is to ensure that whatever value the program is manipulating never exceeds the given size.
Continue reading
Ramanujan Nested Radicals
Difficulty: ★ ★ ★ ★
Srinivasa Ramanujan was a mathematician of the genius variety in that he did amazing things in his short lifetime. The man was insanely brilliant. In fact, he struggled to get other mathematicians to understand his work because it was so unfamiliar. Anyway, he concocted the thing shown in Figure 1, which is one of many Ramanujan Nested Radicals:
Continue reading
It’s All Greek!
Difficulty: ★ ★ ☆ ☆
My recent ctype series got me thinking: What about coding a specific function that works with a non-Latin alphabet? The first alphabet I thought of was Greek. Why not check out the Unicode values of Greek and see whether you can code a few ctype functions that deal with this character set?
Continue reading
That Series That Has No Name but Equals 5e
Difficulty: ★ ★ ☆ ☆
I’d like to know when mathematicians arrive at their “a-hah!” moments. Do they just have an equation pop into their head and mutter, “Golly, I wonder what that means?” Or do they wake up screaming in the middle of the night? Personally, I can well connect with the latter.
Continue reading
Pointers to Multi-Dimension Arrays
Difficulty: ★ ★ ★ ☆
I received a question via email regarding my recently-published book, Dan Gookin’s Guide to C Language Pointers (available at Amazon!). The question: How to use a pointer to navigate a multi-dimension array? While I do cover pointers to an array of strings (which is kinda what the reader wanted), I don’t specifically cover pointers and multi-dimensional arrays. Therefore, I created this month’s exercise to tackle the task.
Continue reading
A Little Bit Off the Sides
Difficulty: ★ ★ ★ ☆
As you might already know, the C language lacks plenty o’ functions readily available in other programming languages. Many of these functions, or “methods,” deal with strings. Though C includes a few basic string functions in its library, the C Lords have determined that when you need another such function, you must code it yourself.
Continue reading
What is the Largest Value?
Difficulty: ★ ★ ☆ ☆
Of all the crazy stuff that happens in the realm of mathematics, I’m certain that mathematicians must enjoy solving math puzzles — just like I assume that good programmers enjoy solving programming puzzles.
Continue reading
Pulling Numbers from a String
Difficulty: ★ ★ ★ ★
Rarely in your programming journey will you encounter a situation where the data you need just pops up fresh, exactly the way you want it. The best situation is where the data is somehow formatted, which makes finding the tidbit you want easier. But often the data is unformatted, which makes fetching that one useful morsel a bit tricky.
Continue reading
Is It a “Real” Triangle?
Difficulty: ★ ★ ☆ ☆
Back in October, the C programming Exercise was to code Heron’s Formula. The challenge required the user to input three values, one for each side of the triangle. But, as I learned since, a triangle must have specific side length ratios for it to be a valid triangle.
Continue reading