From the course: C Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Binary math

Challenge: Binary math - C Tutorial

From the course: C Essential Training

Start my 1-month free trial

Challenge: Binary math

(upbeat electronic music) - [Instructor] Continuing this course challenge, you can use your solution from chapter two, or my solution provided in exercise file 03_13-challenge1.c. You have two major updates to the code. Add code to check input. Ensure that input doesn't exceed 18. Add code to half the value input, as well as double the value input. Here are the details. Below the comment about avoiding out of range values, add aniftest to confirm that input is less than 18. If not, reset the value of variable rows to 18. Below the comment about processing the rows, use binary math to obtain half the value input, then output this value, then use binary math to output double the value input. Sounds like a lot of work, but you can do it. This challenge should take 10 minutes or less to complete.

Contents