{"id":5183,"date":"2022-02-01T00:01:38","date_gmt":"2022-02-01T08:01:38","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=5183"},"modified":"2022-02-18T22:09:19","modified_gmt":"2022-02-19T06:09:19","slug":"the-microwave-problem","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=5183","title":{"rendered":"The Microwave Problem"},"content":{"rendered":"<h2>Difficulty: Medium<\/h2>\n<p>&#8216;<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2022\/02\/my_smart_microwave.jpg\" alt=\"\" width=\"350\" height=\"179\" class=\"alignnone size-full wp-image-5188\" srcset=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2022\/02\/my_smart_microwave.jpg 350w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2022\/02\/my_smart_microwave-300x153.jpg 300w\" sizes=\"auto, (max-width: 350px) 100vw, 350px\" \/><br \/>\nI have a smart microwave oven. Say I need to heat my tea for a minute and a half. I type in 90. When I press the Start button, the 90 transforms into 1:30, a minute thirty. It&#8217;s the same quantity of time, but expressed differently. Such magic is merely clever programming.<br \/>\n<!--more--><br \/>\nYour task for this month&#8217;s Exercise is to write the input routine for a microwave oven. It accepts a given number of seconds, specified as an <em>int<\/em> value. The code digests this number, then outputs the accurate number of hours, minutes, and seconds.<\/p>\n<p>Here is a sample run of my solution:<\/p>\n<p><code>Enter time in seconds: 90<br \/>\nThat's 0:01:30<\/code><\/p>\n<p>And another:<\/p>\n<p><code>Enter time in seconds: 4000<br \/>\nThat's 1:06:40<\/code><\/p>\n<p>And yet another:<\/p>\n<p><code>Enter time in seconds: 604831<br \/>\nThat's 168:00:31<\/code><\/p>\n<p>As a hint, especially if you&#8217;re new to planet Earth: Remember that a minute consists of 60 seconds and an hour consists of 60 minutes or 3600 seconds.<\/p>\n<p><a href=\"https:\/\/c-for-dummies.com\/blog\/?p=5190\">Click here<\/a> to view my solution. Incidentally, my solution uses no decision keywords, only math.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My microwave magically knows that if I input 90 seconds that I want to nuke something for one minute, thirty seconds. <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=5183\">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-5183","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\/5183","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=5183"}],"version-history":[{"count":7,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5183\/revisions"}],"predecessor-version":[{"id":5221,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5183\/revisions\/5221"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5183"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5183"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5183"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}