{"id":4315,"date":"2022-12-08T16:58:30","date_gmt":"2022-12-08T16:58:30","guid":{"rendered":"https:\/\/gyanipandit.com\/programming\/?p=4315"},"modified":"2022-12-08T16:58:31","modified_gmt":"2022-12-08T16:58:31","slug":"c-program-to-find-the-area-of-a-circle","status":"publish","type":"post","link":"https:\/\/gyanipandit.com\/programming\/c-program-to-find-the-area-of-a-circle\/","title":{"rendered":"C program to find the area of a circle"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">C program to find the area of a circle<\/h2>\n\n\n\n<p>In this program, we are going to discuss how to calculate the area of a circle in c. so let&#8217;s start!<\/p>\n\n\n\n<p>Example \u2013<\/p>\n\n\n\n<p><strong>Input &#8211;<\/strong><\/p>\n\n\n\n<p>So first step we are going to take input from the user so we take the radius as 12.<\/p>\n\n\n\n<p><strong>Logic-<\/strong><\/p>\n\n\n\n<p>To calculate the area of the circle you must know the formula to calculate the area of the circle that is :<\/p>\n\n\n\n<p>Area = 3.14 * r * r;<\/p>\n\n\n\n<p><strong>Output-<\/strong><\/p>\n\n\n\n<p>Enter the radius of the circle:22<br>The area of a circle is 1519.760010<\/p>\n\n\n\n<p><strong>Method 1:<\/strong><\/p>\n\n\n\n<p>So let us start to implement this formula in our program.<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">#include&lt;stdio.h&gt;<br>int main()<br>{<br>int radius;<br>float area;<br>printf(&#8220;Enter the radius of the circle: &#8220;);<br>scanf(&#8220;%d&#8221;, &amp;radius);<br>area = 3.14 * radius * radius;<br>printf(&#8220;The radius of the circle is %f&#8221;, area);<br>return 0;<br>}<\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<p>Enter the radius of the circle: 12<br>The radius of the circle is 452.160004<\/p>\n\n\n\n<p><strong>Method 2 \u2013 by using the function<\/strong><\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">#include&lt;stdio.h&gt;<br>float area(int radius){<br>float area;<br>area = 3.14 * radius *radius;<br>return area;<br>}<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">int main()<br>{<br>int radius;<\/p>\n\n\n\n<p class=\"has-white-color has-black-background-color has-text-color has-background\">printf(&#8220;Enter the radius of the circle:&#8221;);<br>scanf(&#8220;%d&#8221;, &amp;radius);<br>printf(&#8220;The area of the circle is %f&#8221;, area(radius));<br>return 0;<br>}<\/p>\n\n\n\n<p><strong>Output<\/strong><\/p>\n\n\n\n<p>Enter the radius of the circle:2<br>The area of the circle is 12.560000<\/p>\n\n\n\n<p>In the first method, we simply calculate the area of a triangle by using a simple method in the second method we calculate the area of a triangle by using the function, I hope these programs are helpful to you to understand the concept to calculate the area of a triangle.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>C program to find the area of a circle In this program, we are going to discuss how to calculate the area of a circle in c. so let&#8217;s start! Example \u2013 Input &#8211; So first step we are going to take input from the user so we take the radius as 12. Logic- To [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[29,43],"class_list":{"0":"post-4315","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-c-program","7":"tag-c-program","8":"tag-c-program-to-find-the-area-of-a-circle"},"_links":{"self":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/comments?post=4315"}],"version-history":[{"count":2,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4315\/revisions"}],"predecessor-version":[{"id":4323,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/posts\/4315\/revisions\/4323"}],"wp:attachment":[{"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/media?parent=4315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/categories?post=4315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gyanipandit.com\/programming\/wp-json\/wp\/v2\/tags?post=4315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}