
{"id":15912,"date":"2014-07-30T15:39:30","date_gmt":"2014-07-30T15:39:30","guid":{"rendered":"http:\/\/www.beautifulwork.org\/?p=15912"},"modified":"2014-07-30T15:39:30","modified_gmt":"2014-07-30T15:39:30","slug":"how-to-write-an-algorithm-to-find-the-number-of-bits-set-in-a-typical-number","status":"publish","type":"post","link":"https:\/\/www.trueangle.org\/index.php\/2014\/07\/30\/how-to-write-an-algorithm-to-find-the-number-of-bits-set-in-a-typical-number\/","title":{"rendered":"How to write an algorithm to find the number of bits set in a typical number ?"},"content":{"rendered":"<pre>\n#include &lt;stdio.h&gt;\ncbs ()\n\n{\nunsigned int v; \/* count the number of bits set in v *\/\nunsigned int c; \/* c accumulates the total bits set in v *\/\n\nprintf(\"Enter v\");\nscanf(\"%u\",&amp;v);\nfor (c = 0; v ; c++)\n{\nv = v &amp; (v - 1); \/* clear the least significant bit set *\/\n}\nprintf(\"The number of bits set in v is %u \\n\",c);\n\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#include &lt;stdio.h&gt; cbs () { unsigned int v; \/* count the number of bits set in v *\/ unsigned int c; \/* c accumulates the total bits set in v *\/ printf(&#8220;Enter v&#8221;); scanf(&#8220;%u&#8221;,&amp;v); for (c = 0; v ; c++) { v = v &amp; (v &#8211; 1); \/* clear the least significant bit &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.trueangle.org\/index.php\/2014\/07\/30\/how-to-write-an-algorithm-to-find-the-number-of-bits-set-in-a-typical-number\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to write an algorithm to find the number of bits set in a typical number ?&#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":[594],"_links":{"self":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15912"}],"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=15912"}],"version-history":[{"count":0,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/posts\/15912\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/media?parent=15912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/categories?post=15912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.trueangle.org\/index.php\/wp-json\/wp\/v2\/tags?post=15912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}