{"id":7424,"date":"2026-03-01T00:01:25","date_gmt":"2026-03-01T08:01:25","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=7424"},"modified":"2026-03-14T10:05:20","modified_gmt":"2026-03-14T17:05:20","slug":"what-is-the-largest-value","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=7424","title":{"rendered":"What is the Largest Value?"},"content":{"rendered":"<h2>Difficulty: &#9733; &#9733; &#9734; &#9734;<\/h2>\n<p>Of all the crazy stuff that happens in the realm of mathematics, I&#8217;m certain that mathematicians must enjoy solving math puzzles &mdash; just like I assume that good programmers enjoy solving programming puzzles.<br \/>\n<!--more--><br \/>\nUnlike programmers, the math nerds most likely break out the slide rules, graph paper, protractors, and what-have-you to solve their mysterious math problems. But for C programmers, the computer solves does the work &mdash; providing that you write good code. This point is where the two artforms intersect.<\/p>\n<p>For this month&#8217;s programming exercise, the math problem reads like this:<\/p>\n<p>Find all positive values a+b+c+d = 36. Then determine which is the largest value generated for ab+bc+cd?<\/p>\n<p>My first reaction upon reading the puzzle was, &#8220;Who cares?&#8221; Well, obviously math nerds may find some reason why performing this task is important or necessary. But for a programmer, your job is to write the code to reveal the answer.<\/p>\n<p>For this challenge, assume that zero is a positive value. You need not output every solution for a+b+c+d = 36. No, just output the largest value possible for (a*b)+(b*c)+(c*d) whenever a+b+c+d = 36.<\/p>\n<p>My solution consists of only two statements, the second being the <em>printf()<\/em> statement that outputs the result: 324<\/p>\n<p>Please try this exercise on your own before you peek at <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=7446\">my solution<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes! Another math problem solved by a computer instead of in your brain. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=7424\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-7424","post","type-post","status-publish","format-standard","hentry","category-exercise"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7424","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7424"}],"version-history":[{"count":6,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7424\/revisions"}],"predecessor-version":[{"id":7486,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7424\/revisions\/7486"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7424"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7424"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7424"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}