Given two equal length chords of a circle and Distance between the centre and one chord. The task is here to find the distance between the centre and the other chord.
Examples:
Input: 48
Output: 48
Input: 82
Output: 82

Below is the implementation of the above approach:
Approach:
Let AB & CD be the two equal chords of the circle having center at O.OM be the given distance of the chord AB from center.
now in triangle AOM and CON,
OA = OC (radii of same circle)
MA = CN (since OM and ON are the perpendicular to the chord and it bisects the chord and AM = MB & CN = CD)
angle AMO = angle ONC = 90 degrees
so the triangles are congruent
so, OM = ON
Equal chords of a circle are equidistant from the centre of a circle.
Below is the implementation of the above approach:
C++
#include <bits/stdc++.h>
using namespace std;
void lengequichord( int z)
{
cout << "The distance between the "
<< "chord and the center is "
<< z << endl;
}
int main()
{
int z = 48;
lengequichord(z);
return 0;
}
|
Java
import java.io.*;
class GFG
{
static void lengequichord( int z)
{
System.out.println ( "The distance between the " +
"chord and the center is " + z );
}
public static void main (String[] args)
{
int z = 48 ;
lengequichord(z);
}
}
|
Python 3
def lengequichord(z):
print ( "The distance between the" ,
"chord and the center is" , z )
if __name__ = = "__main__" :
z = 48
lengequichord(z)
|
C#
using System;
class GFG
{
static void lengequichord( int z)
{
Console.WriteLine( "The distance between the " +
"chord and the center is " + z );
}
public static void Main ()
{
int z = 48;
lengequichord(z);
}
}
|
Javascript
<script>
function lengequichord(z)
{
document.write( "The distance between the "
+ "chord and the center is "
+ z + "<br>" );
}
let z = 48;
lengequichord(z);
</script>
|
Output:
The distance between the chord and the center is 48
Time Complexity: O(1)
Auxiliary Space: O(1)
Feeling lost in the world of random DSA topics, wasting time without progress? It's time for a change! Join our DSA course, where we'll guide you on an exciting journey to master DSA efficiently and on schedule.
Ready to dive in? Explore our Free Demo Content and join our DSA course, trusted by over 100,000 geeks!
Last Updated :
30 May, 2022
Like Article
Save Article