Open In App

Program to calculate angle on circumference subtended by the chord when the central angle subtended by the chord is given

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Share
Report issue
Report

Given a circle having a chord and an angle subtended by chord on center of the circle. The task here is to find the measure of the angle subtended by given chord on the circumference.
 


Examples: 
 

Input: \( \theta \) = 90Output: ABC = 45.00 degreesInput: \( \theta \) = 65Output: ABC = 32.50 degrees


 


Approach:
 

  • Let AC be an chord of a circle with centre O, and let C be any point on the circumference anywhere.
  • Let, angle AOC(on center) is the given                .
  • So angle should be on the circumference, 
    angle ABC = angle AOC/2


 

An angle at the circumference of a circle is the half angle at the center subtended by the same chord.


Below is the implementation of the above approach:
 

C++

// C++ Program to calculate angle
// on the circumference subtended
// by the chord when the central angle
// subtended by the chord is given
#include <iostream>
using namespace std;
 
float angleOncirCumference(float z)
{
    return (z / 2);
}
 
// Driver code
int main()
{
 
    // Angle on center
    float angle = 65;
 
    float z = angleOncirCumference(angle);
 
    cout << "The angle is " << (z) << " degrees";
 
    return 0;
}
 
// This code is contributed by jit_t

                    

Java

// Java Program to calculate angle on the circumference
// subtended by the chord when the central angle
// subtended by the chord is given
 
class GFG {
 
    static float angleOncirCumference(float z)
    {
        return (z / 2);
    }
 
    // Driver code
    public static void main(String[] args)
    {
 
        // Angle on center
        float angle = 65;
 
        float z = angleOncirCumference(angle);
 
        System.out.println("The angle is "
                           + z + " degrees");
    }
}

                    

Python3

# Python3 Program to calculate angle
# on the circumference subtended
# by the chord when the central angle
# subtended by the chord is given
def angleOncirCumference(z):
 
    return (z / 2);
 
# Driver code
 
# Angle on center
angle = 65;
 
z = angleOncirCumference(angle);
 
print("The angle is", (z), "degrees");
 
# This code is contributed by Rajput-Ji

                    

C#

// C# Program to calculate angle on the circumference
// subtended by the chord when the central angle
// subtended by the chord is given
using System;
     
public class GFG
{
 
    static float angleOncirCumference(float z)
    {
        return (z / 2);
    }
 
    // Driver code
    public static void Main(String[] args)
    {
 
        // Angle on center
        float angle = 65;
 
        float z = angleOncirCumference(angle);
 
        Console.WriteLine("The angle is "
                        + z + " degrees");
    }
}
 
// This code is contributed by Rajput-Ji

                    

Javascript

<script>
 
// JavaScript Program to calculate angle
// on the circumference subtended
// by the chord when the central angle
// subtended by the chord is given
 
function angleOncirCumference(z)
{
    return (z / 2);
}
 
// Driver code
 
    // Angle on center
    let angle = 65;
 
    let z = angleOncirCumference(angle);
 
    document.write("The angle is " + (z) + " degrees");
 
// This code is contributed by Surbhi Tyagi.
 
</script>

                    

Output
The angle is 32.5 degrees








Time Complexity: O(1)

Auxiliary Space: O(1)

APPROACH 2 :-

Another approach to find the measure of the angle subtended by a chord on the circumference of a circle, given the central angle subtended by the chord, is as follows:

  1. Let ???? be the central angle in degrees.
  2. Convert ???? from degrees to radians by multiplying it by π     /180 .
  3. Since the angle subtended on the circumference is half the angle at the center, calculate the angle on the circumference (α) using the formula α = ????/2 .
  4. Convert α from radians to degrees by multiplying it by 180/π     .
  5. The resulting value is the measure of the angle subtended by the chord on the circumference.

Below is the implementation of the above approach:

C++

#include <iostream>
#include <iomanip>
#include <cmath>
 
#define PI 3.141
 
float angle_on_circumference(float theta) {
    float theta_rad = theta * PI / 180;
    float alpha_rad = theta_rad / 2;
    float alpha_deg = alpha_rad * 180 / PI;
    return alpha_deg;
}
 
int main() {
    float central_angle = 65;
    float angle_subtended = angle_on_circumference(central_angle);
    std::cout << "The angle is " << std::fixed << std::setprecision(2) << angle_subtended << " degrees" << std::endl;
    return 0;
}

                    

Java

import java.text.DecimalFormat;
 
public class GFG {
    static final double PI = 3.141;
 
    // Function to calculate the angle subtended by a
    // central angle on the circumference of a circle
    static double angleOnCircumference(double theta)
    {
        double thetaRad
            = theta * PI / 180; // Convert angle from
                                // degrees to radians
        double alphaRad
            = thetaRad
              / 2; // Calculate half of the angle in radians
        double alphaDeg
            = alphaRad * 180 / PI; // Convert the half-angle
                                   // back to degrees
        return alphaDeg;
    }
 
    public static void main(String[] args)
    {
        double centralAngle
            = 65; // Given central angle in degrees
        double angleSubtended = angleOnCircumference(
            centralAngle); // Calculate the subtended angle
        DecimalFormat df = new DecimalFormat("0.00");
        System.out.println(
            "The angle is " + df.format(angleSubtended)
            + " degrees"); // Print the result with two
                           // decimal places
    }
}

                    

Python

import math
 
def angle_on_circumference(theta):
    """
    Calculate the angle subtended by a chord on the circumference of a circle.
 
    Args:
        theta (float): The central angle in degrees.
 
    Returns:
        float: The angle subtended by the chord in degrees.
    """
    theta_rad = theta * math.pi / 180  # Convert the central angle from degrees to radians
    alpha_rad = theta_rad / 2  # Calculate half of the central angle in radians
    alpha_deg = alpha_rad * 180 / math.pi  # Convert the half angle from radians to degrees
    return alpha_deg
 
def main():
    """
    Main function to calculate and display the angle subtended by a chord on the circumference of a circle.
 
    The central angle is given as 65 degrees, and the angle subtended by the chord is calculated and displayed.
    """
    central_angle = 65
    angle_subtended = angle_on_circumference(central_angle)
    print(f"The angle is {angle_subtended:.2f} degrees")
 
if __name__ == "__main__":
    main()
# This code is contributed by sarojmcy2e

                    

C#

using System;
 
class GFG {
    const float PI = 3.141f;
 
    // Function to calculate the angle subtended on the
    // circumference
    static float AngleOnCircumference(float theta)
    {
        float thetaRad = theta * PI / 180;
        float alphaRad = thetaRad / 2;
        float alphaDeg = alphaRad * 180 / PI;
        return alphaDeg;
    }
 
    static void Main()
    {
        float centralAngle = 65;
        float angleSubtended
            = AngleOnCircumference(centralAngle);
 
        // Print the calculated angle with 2 decimal places
        Console.WriteLine("The angle is "
                          + angleSubtended.ToString("F2")
                          + " degrees");
    }
}

                    

Javascript

// Define a constant for PI
const PI = 3.141;
 
// Function to calculate the half of an angle on the circumference in degrees
function angle_on_circumference(theta) {
    // Convert the input angle from degrees to radians
    const theta_rad = theta * (PI / 180);
 
    // Calculate the half angle in radians
    const alpha_rad = theta_rad / 2;
 
    // Convert the half angle back to degrees
    const alpha_deg = alpha_rad * (180 / PI);
 
    // Return the result
    return alpha_deg;
}
 
// Main function
function main() {
    // Define the central angle in degrees
    const central_angle = 65;
 
    // Calculate the half angle subtended by the central angle
    const angle_subtended = angle_on_circumference(central_angle);
 
    // Display the result with two decimal places
    console.log(`The angle is ${angle_subtended.toFixed(2)} degrees`);
}
 
// Call the main function to execute the program
main();

                    

Output
The angle is 32.50 degrees








Time Complexity: O(1)

Auxiliary Space: O(1)



Last Updated : 25 Sep, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads