Program to calculate angle on circumference subtended by the chord when the central angle subtended by the chord is given
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: = 90Output: ABC = 45.00 degreesInput: = 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++
#include <iostream>
using namespace std;
float angleOncirCumference( float z)
{
return (z / 2);
}
int main()
{
float angle = 65;
float z = angleOncirCumference(angle);
cout << "The angle is " << (z) << " degrees" ;
return 0;
}
|
Java
class GFG {
static float angleOncirCumference( float z)
{
return (z / 2 );
}
public static void main(String[] args)
{
float angle = 65 ;
float z = angleOncirCumference(angle);
System.out.println( "The angle is "
+ z + " degrees" );
}
}
|
Python3
def angleOncirCumference(z):
return (z / 2 );
angle = 65 ;
z = angleOncirCumference(angle);
print ( "The angle is" , (z), "degrees" );
|
C#
using System;
public class GFG
{
static float angleOncirCumference( float z)
{
return (z / 2);
}
public static void Main(String[] args)
{
float angle = 65;
float z = angleOncirCumference(angle);
Console.WriteLine( "The angle is "
+ z + " degrees" );
}
}
|
Javascript
<script>
function angleOncirCumference(z)
{
return (z / 2);
}
let angle = 65;
let z = angleOncirCumference(angle);
document.write( "The angle is " + (z) + " degrees" );
</script>
|
OutputThe 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:
- Let ???? be the central angle in degrees.
- Convert ???? from degrees to radians by multiplying it by /180 .
- Since the angle subtended on the circumference is half the angle at the center, calculate the angle on the circumference (α) using the formula α = ????/2 .
- Convert α from radians to degrees by multiplying it by 180/ .
- 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 ;
static double angleOnCircumference( double theta)
{
double thetaRad
= theta * PI / 180 ;
double alphaRad
= thetaRad
/ 2 ;
double alphaDeg
= alphaRad * 180 / PI;
return alphaDeg;
}
public static void main(String[] args)
{
double centralAngle
= 65 ;
double angleSubtended = angleOnCircumference(
centralAngle);
DecimalFormat df = new DecimalFormat( "0.00" );
System.out.println(
"The angle is " + df.format(angleSubtended)
+ " degrees" );
}
}
|
Python
import math
def angle_on_circumference(theta):
theta_rad = theta * math.pi / 180
alpha_rad = theta_rad / 2
alpha_deg = alpha_rad * 180 / math.pi
return alpha_deg
def main():
central_angle = 65
angle_subtended = angle_on_circumference(central_angle)
print (f "The angle is {angle_subtended:.2f} degrees" )
if __name__ = = "__main__" :
main()
|
C#
using System;
class GFG {
const float PI = 3.141f;
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);
Console.WriteLine( "The angle is "
+ angleSubtended.ToString( "F2" )
+ " degrees" );
}
}
|
Javascript
const PI = 3.141;
function angle_on_circumference(theta) {
const theta_rad = theta * (PI / 180);
const alpha_rad = theta_rad / 2;
const alpha_deg = alpha_rad * (180 / PI);
return alpha_deg;
}
function main() {
const central_angle = 65;
const angle_subtended = angle_on_circumference(central_angle);
console.log(`The angle is ${angle_subtended.toFixed(2)} degrees`);
}
main();
|
OutputThe angle is 32.50 degrees
Time Complexity: O(1)
Auxiliary Space: O(1)
Last Updated :
25 Sep, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...