{"id":30306,"date":"2016-02-08T10:37:09","date_gmt":"2016-02-08T16:37:09","guid":{"rendered":"http:\/\/rhcpalmarichiewordpresscom.wordpress.com\/?p=219"},"modified":"2016-02-08T10:57:12","modified_gmt":"2016-02-08T16:57:12","slug":"wsq07-sum-of-numbers-6","status":"publish","type":"post","link":"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq07-sum-of-numbers-6\/","title":{"rendered":"WSQ07 \u2018Sum of Numbers\u2019"},"content":{"rendered":"<p>Ever wondered what is the result of the addition of\u00a0all the intergers from a certain range? Of course not, but let&#8217;s calculate it!<\/p>\n<figure data-shortcode=\"caption\" id=\"attachment_227\" style=\"width: 140px\" class=\"wp-caption alignleft\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone  wp-image-227\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/4a2102340f78ed964ef552c34c755263.jpg#038;h=168\" alt=\"okami doge\" width=\"140\" height=\"168\" \/><figcaption class=\"wp-caption-text\">Sorry, been playing Okami lately.\u00a0<\/figcaption><\/figure>\n<p>What I mean by &#8216;Sum of Numbers&#8217;, it is for example: from a range of 5 to 10 one has to sum 5 + 6+ 7 + 8 + 9 + 10. This has to be done in order to get the final result of 45. \u00a0Sounds easy right? But what if the range was bigger? For example from 1 to 100. One is not going to grab a calculator and start &#8220;1+2+3+4+5+6+7+8+9+(&#8230;)+100&#8221;. Of course not! This is why I was in charge of programming a code were the computer automatically does this.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>I will be using the classic variables &#8220;x&#8221; and &#8220;y&#8221; to define the range. This time &#8220;x&#8221; is the number we begin, and &#8220;y&#8221; is the number the addition countdown stops. However, I had to make a prediction were the user actually submits &#8220;x&#8221; higher than &#8220;y&#8221;. This would me impossible since the program is unable to count backwards. So I used a conditional &#8220;If&#8221; to let the user know what the mistake is. In the end, this is my code.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-241\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/d8535acc9d5b897b2bc434c6aef5e8e1.jpg\" alt=\"WSQ07 code\"   \/><\/p>\n<p>Looks cool right? It looks better when one uses it.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-245\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/69e2bd1f07b48849f3f7a8a87bbef022.jpg\" alt=\"wsq07run\"   \/><\/p>\n<p>This blog corresponds to the song &#8220;After Midnight&#8221; by Blin182. I am not that old, yet I know that band brings nostalgia to most of the 90&#8217;s kids. This song was recommended by an old friend of mine, and I have must say thanks to her for introducing me this awesome song.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-250\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/106d1f312594534285d4de841ce062e2.jpg\" alt=\"After Midnight\"   \/><\/p>\n<p>&nbsp;<\/p>\n<p>  <a rel=\"nofollow\" href=\"http:\/\/feeds.wordpress.com\/1.0\/gocomments\/rhcpalmarichiewordpresscom.wordpress.com\/219\/\"><img decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/ad61588a823b974246f76526befea849.jpg\" \/><\/a> <img loading=\"lazy\" decoding=\"async\" alt=\"\" border=\"0\" src=\"http:\/\/kenscourses.com\/tc101winter2016\/wp-content\/uploads\/2016\/02\/bfee56a7cba2011097b6517c3c1fad7f.jpg#038;blog=105330260&#038;%23038;post=219&#038;%23038;subd=rhcpalmarichiewordpresscom&#038;%23038;ref=&#038;%23038;feed=1\" width=\"1\" height=\"1\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever wondered what is the result of the addition of\u00a0all the intergers from a certain range? Of course not, but let&#8217;s calculate it! Sorry, been playing Okami lately.\u00a0 What I mean by &#8216;Sum of Numbers&#8217;, it is for example: from a range of 5 to 10 one has to sum 5 + 6+ 7 + &hellip; <a href=\"https:\/\/kenscourses.com\/tc101winter2016\/2016\/02\/wsq07-sum-of-numbers-6\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">WSQ07 \u2018Sum of Numbers\u2019<\/span><\/a><\/p>\n","protected":false},"author":33,"featured_media":30311,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,4],"tags":[124,125,24],"class_list":["post-30306","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blogs","category-syndicated","tag-ironfromice","tag-wsq07","tag-wsq"],"_links":{"self":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/users\/33"}],"replies":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/comments?post=30306"}],"version-history":[{"count":3,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30306\/revisions"}],"predecessor-version":[{"id":30321,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/posts\/30306\/revisions\/30321"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media\/30311"}],"wp:attachment":[{"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/media?parent=30306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/categories?post=30306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kenscourses.com\/tc101winter2016\/wp-json\/wp\/v2\/tags?post=30306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}