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
Category Archives: Solution
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
Clear the Screen – Solution
The task for this month’s Exercise is to clear the screen. I pray you didn’t arrive at a solution that outputs multiple blank lines. No, you must use the ANSI codes offered in the exercise post to manipulate the cursor and wipe clean the screen. Or you could cheat, which is what I did.
Continue reading
Adding Two Values – Solutions
This month’s Exercise is rather simple, though it doesn’t promise a simple solution. Instead, I offer three solutions. One of which is obvious and two are kind of out there. They all work, which is the point.
Continue reading
Calculating the Standard Deviation – Solution
The challenge for this month’s Exercise is to calculate the standard deviation for a given set of data points. It’s a “whole population calculation” because all the data points are present. The trick is to follow the equation, transforming it from cryptic math mumbo-jumbo into C code.
Continue reading
Calculating the Absolute Value – Solution
This month’s Exercise may not have been challenging. Still, remember that blog is about learning the C language. Sometimes performing what could be a simple task may end up being complex than you anticipated.
Continue reading
Calculating the Subfactorial – Solution
Do you feel adequately deranged working this month’s Exercise? I’m more of a math fanboy than an expert, yet I enjoyed the process of coding a subfactorial based in the equation presented.
Continue reading
Positive Negative Positive Negative – Solution
This month’s Exercise presents what I often refer to as a code “toggle.” Many paths lead to a solution.
Continue reading