This month’s Exercise required you to create three rounding functions: roundup(), rounddown(), and roundhalf(). Each one deals with a floating-point value in a specific way, but they all handle the basic rounding chore by typecasting a floating point variable to an integer.
Continue reading
Category Archives: Solution
Just Average – Solution
If you attempted to compile the code skeleton for this month’s Exercise, you most likely stumbled across the first problem to solve: The average() function requires a type.
Continue reading
Making Change – Solution
To solve this month’s Exercise you had to figure out a way to divvy up a dollar amount into the proper number of quarters, dimes, nickels, and pennies. As with many programming puzzles, a number of ways exist to code a solution. Click here to view mine.
Continue reading
From Text to Integer – Solution
This month’s Exercise is to code a function that converts a string of text numbers into an integer value. If you used the skeleton provided, then your program’s output would look like this:
The string 24680 represents value 24680.
The Inverse Pyramid – Solution
The task for this month’s Exercise was to create code that outputs an inverse number pyramid.
Here’s what such a thing looks like:
0000000000
999999999
88888888
7777777
666666
55555
4444
333
22
1