{"id":775,"date":"2021-10-30T03:43:24","date_gmt":"2021-10-30T03:43:24","guid":{"rendered":"https:\/\/ethosspace.com\/programmers\/?p=775"},"modified":"2021-11-05T10:38:30","modified_gmt":"2021-11-05T10:38:30","slug":"find-number-divisible-by-3-or-5-till-user-input-in-c","status":"publish","type":"post","link":"https:\/\/ethosspace.com\/programmers\/find-number-divisible-by-3-or-5-till-user-input-in-c\/","title":{"rendered":"Number divisible by 3 or 5 in C Language"},"content":{"rendered":"\n<p>This C Program will accept number accept range from user and then print numbers which are divisible by 3 or 5.<\/p>\n\n\n\n<p>In this program we have accepted range from user. After that using mod operator and for loop we are printing numbers which are divisible by 3 or 5. <a href=\"https:\/\/ethosspace.com\/programmers\/online-c-compilers-easy-to-debug-and-run\/\" title=\"Online C Compilers easy to debug and run\">Compile <\/a>and Run below program to get the output.<\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-c\" data-lang=\"C\"><code>#include &lt;stdio.h&gt;\n\nint main() {\n \n    int rangeNo;\n    printf(&quot;Enter number upto which you need to find number divisible by 3 or 5&quot;);\n    scanf(&quot;%d&quot;,&rangeNo);\n    \/\/Loop to print number which are divisible by 3\n    printf(&quot;\\n\\nThese numbers are divisible by 3\\n\\n\\t\\t&quot;);\n    for (int i = 1;i&lt;=rangeNo;i++)\n    {\n        \n        if (i%3==0)\n        printf(&quot;\\t%d&quot;,i);\n    }\n    printf(&quot;\\n\\nThese numbers are divisible by 5\\n\\n\\t\\t&quot;);\n    for (int i = 1;i&lt;=rangeNo;i++)\n    {\n        \n        if (i%5==0)\n        printf(&quot;\\t%d&quot;,i);\n    }\n    return 0;\n}<\/code><\/pre><\/div>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<div class=\"hcb_wrap\"><pre class=\"prism line-numbers lang-plain\"><code>Enter number upto which you need to find number divisible by 3 or 5300\nThese numbers are divisible by 3\n\n\t\t\t3\t6\t9\t12\t15\t18\t21\t24\t27\t30\t33\t36\t39\t42\t45\t48\t51\t54\t\n57\t60\t63\t66\t69\t72\t75\t78\t81\t84\t87\t90\t93\t96\t99\t102\t105\t108\t\n111\t114\t117\t120\t123\t126\t129\t132\t135\t138\t141\t144\t147\t150\t153\t156\t159\t162\t\n165\t168\t171\t174\t177\t180\t183\t186\t189\t192\t195\t198\t201\t204\t207\t210\t213\t216\t\n219\t222\t225\t228\t231\t234\t237\t240\t243\t246\t249\t252\t255\t258\t261\t264\t267\t270\t273\t276\t279\t282\t285\t288\t291\t294\t297\t300\n\nThese numbers are divisible by 5\n\n\t\t\t5\t10\t15\t20\t25\t30\t35\t40\t45\t50\t55\t60\t65\t70\t75\t80\t85\t\n90\t95\t100\t105\t110\t115\t120\t125\t130\t135\t140\t145\t150\t155\t160\t165\t170\t175\t\n180\t185\t190\t195\t200\t205\t210\t215\t220\t225\t230\t235\t240\t245\t250\t255\t260\t265\t\n270\t275\t280\t285\t290\t295\t300<\/code><\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This C Program will accept number accept range from user and then print numbers which are divisible by 3 or 5. In this program we have accepted range from user. After that using mod operator and for loop we are printing numbers which are divisible by 3 or 5. Compile and Run below program to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","footnotes":""},"categories":[6],"tags":[],"class_list":["post-775","post","type-post","status-publish","format-standard","hentry","category-c-language"],"aioseo_notices":[],"uagb_featured_image_src":{"full":false,"thumbnail":false,"medium":false,"medium_large":false,"large":false,"1536x1536":false,"2048x2048":false,"sparkling-featured":false,"sparkling-featured-fullwidth":false,"tab-small":false},"uagb_author_info":{"display_name":"program45_-rt8nb","author_link":"https:\/\/ethosspace.com\/programmers\/author\/program45_-rt8nb\/"},"uagb_comment_info":0,"uagb_excerpt":"This C Program will accept number accept range from user and then print numbers which are divisible by 3 or 5. In this program we have accepted range from user. After that using mod operator and for loop we are printing numbers which are divisible by 3 or 5. Compile and Run below program to&hellip;","_links":{"self":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/comments?post=775"}],"version-history":[{"count":12,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/775\/revisions"}],"predecessor-version":[{"id":902,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/posts\/775\/revisions\/902"}],"wp:attachment":[{"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/media?parent=775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/categories?post=775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ethosspace.com\/programmers\/wp-json\/wp\/v2\/tags?post=775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}