Removing redundancies from your C code may not be your first goal, but it’s something you can definitely find later. One example is when you must initialize a pair of arrays. Why use two loops when one will do?
Continue reading
Category Archives: Exercise
Find the Most Factors
If given a pad, pencil, and a factor problem years ago, I would have found doing anything else in the world more exciting. Math is not my forte, yet it remains a curiosity. Especially with The Power Of The Computer, performing math exercises is more of an interesting challenge than a mental ordeal.
Continue reading
Some Weighty Conversions
The three units of weight I’m familiar with are pounds, kilograms, and stone. For me, stone is the odd one. I’ve heard it used in Britain and it’s completely baffling to me, often requiring that I whip out a calculator to see what “14 stone” really means. Better, I could write code that converts between pounds, kilograms, and stone, which is the goal of this month’s Exercise.
Continue reading
Calculating Months
I recently updated my Wambooli website’s front page to show only recent blog posts. I don’t regularly maintain the Wamblog any longer, so it was disappointing for me to see “recent posts” from ages ago. Therefore, I did a little coding to ensure that only recent posts appear or nothing.
Continue reading
A Cumulative Total
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
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