I remember the first time I heard the puzzle: If you’re paid a penny on the first day, doubled on the second day, and doubled every day after, by the end of the month you’d be a millionaire many times over. This concept is mind boggling.
Continue reading
Category Archives: Exercise
Spelling Numbers
I would guess that most beginning programmers can deftly craft a loop that outputs sequential integer values, say from 0 to 100. In fact, this is the type of code I write whenever I learn a new language. I asked myself, “Can I write a loop to output values 0 to 100?” Usually in no time, I’ve constructed such a program. Simple.
Continue reading
Multiples of Four
I enjoy playing number games. I’m not good at it, but I enjoy playing them. Recently such a game piqued my curiosity enough to consider it for my monthly C For Dummies exercise: 21
Continue reading
Nested Processing
After a few intermediate to advanced Exercises, I decided to try something that’s a little easier this month. Still, even if you’re a pro, it helps to pull back and try something basic just to see what you can do with it.
Continue reading
Getting to Euler’s Number
I enjoy reading about and studying mathematics. One of my favorite books is A History of π. I’ve used this book to inspire my Pi Day (March 14) programs. It’s fascinating stuff.
Continue reading
Tic-Tac-Toe Evaluation
This month’s Exercise may seem like a repeat of the Exercise “We Have a Winnah!” from July of 2013. It’s not.
Continue reading
No Nines!
Like many innocent and silly math games, No Nines is nerdy to play but fun to code. The game works like this:
Continue reading
Dump That File!
One of the many, useful tools a programmer must have is a hexdump utility. The utility consumes a file’s raw bytes and outputs them in a human-readable manner. By examining the dump, you can determine if file contains the proper data in the correct format, as well as do other interesting, useful, and technerd things.
Continue reading
Automated Guessing Game
Last month, I published a post of the classic programming chestnut, a number-guessing game. In the post, I wrote: “Variable tries
is set equal to 6 because I read somewhere that it’s possible to guess a value between 1 and 100 in six or fewer tries (though I’m probably incorrect).” And, yes, I was wrong.
Continue reading
Remove Trailing Blank Lines
Recently, I wrote a utility that required the final line of text in a file to terminate with a special code. The code had to sit at the end of a line of text, not on a blank line. What I discovered is that many text files end with one or more blank lines.
Continue reading