{"id":22919,"date":"2021-09-29T20:14:31","date_gmt":"2021-09-29T14:44:31","guid":{"rendered":"https:\/\/python-programs.com\/?p=22919"},"modified":"2021-11-22T18:35:35","modified_gmt":"2021-11-22T13:05:35","slug":"python-program-to-find-area-of-a-circular-sector","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-area-of-a-circular-sector\/","title":{"rendered":"Python Program To Find Area of a Circular Sector"},"content":{"rendered":"
In the previous article, we have discussed Python Program for Arc Length from Given Angle<\/a> Given the radius and angle of a circle, the task is to calculate the area of the circular sector in python.<\/p>\n Formula:<\/strong><\/p>\n Area of sector = (angle\/360)*(pi * radius\u00b2)<\/p>\n where pi=3.1415….<\/p><\/blockquote>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to calculate the area of the circular sector for the given radius and angle in python:<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Grab the opportunity and utilize the Python Program Code Examples<\/a> over here to prepare basic and advanced topics too with ease and clear all your doubts.<\/p>\n In the previous article, we have discussed Python Program for Arc Length from Given Angle A circular sector, also known as a circle sector, is a portion of a disc bounded by two radii and an arc, with the smaller area known as the minor sector and the larger as the major sector. Given the …<\/p>\n
\nA circular sector, also known as a circle sector, is a portion of a disc bounded by two radii and an arc, with the smaller area known as the minor sector and the larger as the major sector.<\/p>\nGiven radius = 24\r\nGiven Angle = 90<\/pre>\n
The area of circular sector for the given angle { 90 } degrees = 452.57142857142856<\/pre>\n
Given radius = 15.5\r\nGiven Angle = 45<\/pre>\n
The area of circular sector for the given angle { 45.0 } degrees = 94.38392857142857<\/pre>\n
Program To Find Area of a Circular Sector in Python<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Give the radius as static input and store it in a variable.\r\ngvn_radiuss = 24\r\n# Give the angle as static input and store it in another variable.\r\ngvn_angl = 90\r\n# Take a variable and initialize its value to 22\/7.\r\ngvn_pi = 22\/7\r\n# Check if the given angle is greater than or equal to 360 degrees or not using the\r\n# if conditional statement.\r\nif gvn_angl >= 360:\r\n # If it is true, then print \"Invalid Angle. Please enter the other\"\r\n print(\"Invalid Angle. Please enter the other\")\r\nelse:\r\n # Else, calculate the area of circular sector using the above given mathematical\r\n # formula and store it in a variable.\r\n area_of_sectr = (gvn_pi * gvn_radiuss ** 2) * (gvn_angl \/ 360)\r\n # Print the area of circular sector for the given angle.\r\n print(\"The area of circular sector for the given angle {\",\r\n gvn_angl, \"} degrees = \", area_of_sectr)\r\n<\/pre>\n
#include <iostream>\r\n#include<math.h>\r\nusing namespace std;\r\n\r\nint main() {\r\n int gvn_radiuss = 24;\r\n int gvn_angl = 90;\r\n int gvn_pi = 22 \/ 7;\r\n if ( gvn_angl >= 360 ) {\r\n printf ( \"Invalid Angle. Please enter the other\\n\" );\r\n }\r\n else {\r\n float area_of_sectr = ( gvn_pi * gvn_radiuss * gvn_radiuss ) * ( gvn_angl \/ 360 );\r\n printf ( \"The area of circular sector for the given angle {%d} degrees = %d\\n\", gvn_angl, area_of_sectr );\r\n }\r\n\r\n return 0;\r\n}\r\n\r\n\r\n\r\n<\/pre>\n
The area of circular sector for the given angle { 90 } degrees = 452.57142857142856<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Give the radius as user input using the float(input()) function and store it in a variable.\r\ngvn_radiuss = float(input(\"Enter some Random Number = \"))\r\n# Give the angle as user input using the float(input()) function and store it in another variable.\r\ngvn_angl = float(input(\"Enter some Random Number = \"))\r\n# Take a variable and initialize its value to 22\/7.\r\ngvn_pi = 22\/7\r\n# Check if the given angle is greater than or equal to 360 degrees or not using the\r\n# if conditional statement.\r\nif gvn_angl >= 360:\r\n # If it is true, then print \"Invalid Angle. Please enter the other\"\r\n print(\"Invalid Angle. Please enter the other\")\r\nelse:\r\n # Else, calculate the area of circular sector using the above given mathematical\r\n # formula and store it in a variable.\r\n area_of_sectr = (gvn_pi * gvn_radiuss ** 2) * (gvn_angl \/ 360)\r\n # Print the area of circular sector for the given angle.\r\n print(\"The area of circular sector for the given angle {\",\r\n gvn_angl, \"} degrees = \", area_of_sectr)\r\n<\/pre>\n
Enter some Random Number = 15.5\r\nEnter some Random Number = 45\r\nThe area of circular sector for the given angle { 45.0 } degrees = 94.38392857142857<\/pre>\n
\n