
{"id":15971,"date":"2014-09-26T13:52:38","date_gmt":"2014-09-26T13:52:38","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=15971"},"modified":"2014-09-26T13:52:38","modified_gmt":"2014-09-26T13:52:38","slug":"how-to-write-an-algorithm-to-reverse-an-integer","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/09\/26\/how-to-write-an-algorithm-to-reverse-an-integer\/","title":{"rendered":"How to write an algorithm to reverse an integer ?"},"content":{"rendered":"<pre>\n\/* Part of this work is copied from http:\/\/www.sanfoundry.com\/c-program-to-reverse-a-given-number\/ *\/\n\n#include &lt;stdio.h&gt;\n\nrevint()\n{\n\nlong num, reverse = 0, temp, remainder;\nprintf(\"Enter the number \\n\");\nscanf(\"%ld\",&amp;num);\ntemp = num;\nwhile ( num &gt; 0 )\n{\nremainder = num % 10;\nreverse = reverse * 10 + remainder;\nnum \/= 10;\n}\nprintf(\"Given number = %ld \\n\", temp);\nprintf(\"It's reverse = %ld \\n\", reverse);\n}\n\n\/* http:\/\/stackoverflow.com\/questions\/15349723\/reversing-an-integer-in-java-using-a-for-loop *\/\n\/* http:\/\/math.stackexchange.com\/questions\/480068\/how-to-reverse-digits-of-an-integer-mathematically *\/\n\n&nbsp;\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\/* Part of this work is copied from http:\/\/www.sanfoundry.com\/c-program-to-reverse-a-given-number\/ *\/ #include &lt;stdio.h&gt; revint() { long num, reverse = 0, temp, remainder; printf(&#8220;Enter the number \\n&#8221;); scanf(&#8220;%ld&#8221;,&amp;num); temp = num; while ( num &gt; 0 ) { remainder = num % 10; reverse = reverse * 10 + remainder; num \/= 10; } printf(&#8220;Given number = &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2014\/09\/26\/how-to-write-an-algorithm-to-reverse-an-integer\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to write an algorithm to reverse an integer ?&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[141,21,91],"tags":[1383],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15971"}],"collection":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/comments?post=15971"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15971\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=15971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=15971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=15971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}