{"id":16982,"date":"2021-08-12T09:25:23","date_gmt":"2021-08-12T03:55:23","guid":{"rendered":"https:\/\/python-programs.com\/?p=16982"},"modified":"2021-11-22T18:38:31","modified_gmt":"2021-11-22T13:08:31","slug":"python-program-to-find-out-the-arc-length-of-an-angle","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-find-out-the-arc-length-of-an-angle\/","title":{"rendered":"Python Program to Find out the Arc Length of an Angle"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Calculate Surface Area and Volume of a Cylinder<\/a> The length of an arc is defined as the length of a circle’s circumference.<\/p>\n The arc length formula<\/strong> is as follows:<\/p>\n Arc length = (\u03c0*d) * (A\/360)<\/strong><\/p>\n where ‘d ‘ is the diameter of the circle.<\/p>\n ‘A’ is the angle.<\/p>\n Given the diameter and angle of the circle, and the task is to find the arc length of the given angle.<\/p>\n Examples:<\/strong><\/p>\n Example 1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:\u00a0<\/strong><\/p>\n Example 2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:\u00a0<\/strong><\/p>\n Below are the ways to find the arc length of the given angle.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:\u00a0<\/strong><\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:\u00a0<\/strong><\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" In the previous article, we have discussed Python Program to Calculate Surface Area and Volume of a Cylinder Arc Length : The length of an arc is defined as the length of a circle’s circumference. The arc length formula is as follows: Arc length = (\u03c0*d) * (A\/360) where ‘d ‘ is the diameter of …<\/p>\n
\nArc Length :<\/strong><\/p>\nGiven Diameter = 10\r\nGiven Angle = 100<\/pre>\n
The arc length of the given angle = 8.727<\/pre>\n
Given Diameter = 15\r\nGiven Angle =\u00a0 450<\/pre>\n
The above Entered Angle is Invalid<\/pre>\n
Program to Find out the Arc Length of an Angle<\/h2>\n
\n
Method #1: Using Mathematical Formula (Static Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the diameter of the circle as static input\u00a0and store it in a variable.\r\ngvn_diametr = 10\r\n# Give the angle as static input\u00a0and store it in another variable.\r\ngvn_Angle = 100\r\n# Check if the given angle is greater than or equal to 360 using if conditional statement.\r\nif gvn_Angle >= 360:\r\n # If the statement is true, then print \"The above Entered Angle is Invalid\".\r\n print(\"The above Entered Angle is Invalid\")\r\nelse:\r\n # Else Calculate the Arc length of the given angle using the above mathematical formula,\r\n # math.pi() method and store it in another variable.\r\n Arc_len = (math.pi*gvn_diametr) * (gvn_Angle\/360)\r\n# Print the arc length of the given angle.\r\n print(\"The arc length of the given angle = %.3f\" % Arc_len)\r\n<\/pre>\n
The arc length of the given angle = 8.727<\/pre>\n
Method #2: Using Mathematical Formula (User Input)<\/h3>\n
\n
# Import math module using the import keyword.\r\nimport math\r\n# Give the diameter of the circle as user input using the float(input()) function\u00a0and\r\n# store it in a variable.\r\ngvn_diametr = float(input(\"Enter some random number = \"))\r\n# Give the angle as user input using the float(input()) function\u00a0and\r\n# store it in another variable.\r\ngvn_Angle = float(input(\"Enter some random number = \"))\r\n# Check if the given angle is greater than or equal to 360 using if conditional statement.\r\nif gvn_Angle >= 360:\r\n # If the statement is true, then print \"The above Entered Angle is Invalid\".\r\n print(\"The above Entered Angle is Invalid\")\r\nelse:\r\n# Else Calculate the Arc length of the given angle using the above mathematical formula,\r\n# math.pi() method and store it in another variable.\r\n Arc_len = (math.pi*gvn_diametr) * (gvn_Angle\/360)\r\n# Print the arc length of the given angle.\r\n print(\"The arc length of the given angle = %.3f\" % Arc_len)\r\n<\/pre>\n
Enter some random number = 15\r\nEnter some random number = 90\r\nThe arc length of the given angle = 11.781<\/pre>\n
\n