Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Category Archives: Solution

Post navigation

← Older posts
Newer posts →

Positive, Negative, or Zero – Solution

Posted on March 8, 2021 by dgookin
6

Your challenge for this month’s Exercise is to write a sign() function, which returns 1, 0, or -1 depending on the sign of an integer. A relatively simple thing to code — I hope!
Continue reading →

Posted in Solution | 6 Replies

A Pair of Arrays – Solution

Posted on February 8, 2021 by dgookin
2

The challenge for this month’s Exercise is to initialize two different arrays to two sets of values. You should try to use only one loop and try to use a single statement to make the element assignments.
Continue reading →

Posted in Solution | 2 Replies

Find the Most Factors – Solution

Posted on January 8, 2021 by dgookin
Reply

The challenge for this month’s Exercise is to discover those values in the range 1 to 999 that have the highest number of factors. Never mind the math! Let C and the computer do the work for you.
Continue reading →

Posted in Solution | Leave a reply

Some Weighty Conversions – Solution

Posted on December 8, 2020 by dgookin
Reply

This month’s Exercise is to create a program that converts weight measurements by using this format:

nnnFT

Where nnn is a value, F is the unit to convert from, and T is the unit to convert to. This problem is more of an input-parsing exercise than a straight conversion.
Continue reading →

Posted in Solution | Leave a reply

Calculating Months – Solution

Posted on November 8, 2020 by dgookin
Reply

The task for this month’s Exercise is to return the month number for a time_t value. Effectively you extract the year and month, do some math, presto. Could it be this easy?
Continue reading →

Posted in Solution | Leave a reply

A Cumulative Total – Solution

Posted on October 8, 2020 by dgookin
Reply

I find it odd that the recursive solution for this month’s Exercise is far shorter than the non-recursive version. Yet, it has an elegance that’s evident in lots of recursive code examples.
Continue reading →

Posted in Solution | Leave a reply

Spelling Numbers – Solution

Posted on September 8, 2020 by dgookin
Reply

The task for this month’s Exercise is to write code that outputs strings for number values, 0 through 100. Your goal is to be clever with your solution, something that took me a few versions to get correct.
Continue reading →

Posted in Solution | Leave a reply

Multiples of Four – Solution

Posted on August 8, 2020 by dgookin
Reply

The solution this month’s Exercise isn’t that complex, but it was handy in disproving a theory.
Continue reading →

Posted in Solution | Leave a reply

Nested Processing – Solution

Posted on July 8, 2020 by dgookin
5

This month’s Exercise wasn’t astronomically difficult, but I did spend some time devising a solution. My goal was to try to avoid writing a nested loop. This goal proved unattainable.
Continue reading →

Posted in Solution | 5 Replies

Getting to Euler’s Number – Solution

Posted on June 8, 2020 by dgookin
Reply

The challenge for this month’s Exercise is not only to calculate Euler’s number, e, but to count how many loops a program must endure before your e value calculation matches the defined constant M_E. I hope you didn’t find this challenge too difficult.
Continue reading →

Posted in Solution | Leave a reply

Post navigation

← Older posts
Newer posts →

Recent Posts

  • C Blog 13th Anniversary
  • Colorful Data Chunks
  • A Little Bit Off the Sides – Solution
  • Working with Data Chunks
  • A Little Bit Off the Sides

Recent Comments

  • dgookin on C Blog 13th Anniversary
  • M.Stumpfl on C Blog 13th Anniversary
  • Chris Webb on C Blog 13th Anniversary
  • M.Stumpfl on A Little Bit Off the Sides – Solution
  • dgookin on A Little Bit Off the Sides – Solution

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress