Open In App

Length of the chord the circle if length of the another chord which is equally inclined through the diameter is given

Given are two chords which are equally inclined through the diameter of the circle. Length of one chord is given. The task is to find the length of another chord.
Examples: 
 

Input: z = 48
Output: 48 degrees

Input: z = 93
Output: 93 degrees

 



Approach
 



 

If two chords are equally inclined through the diameter of the same circle, then they are of equal length.

Below is the implementation of the above approach:
 




// C++ program to find
// the length of the chord the circle
// if length of the another chord
// which is equally inclined
// through the diameter is given
 
#include <bits/stdc++.h>
using namespace std;
 
void lengchord(int z)
{
    cout << "The length is "
         << z << endl;
}
 
// Driver code
int main()
{
    int z = 48;
    lengchord(z);
    return 0;
}




// Java program to find
// the length of the chord the circle
// if length of the another chord
// which is equally inclined
// through the diameter is given
import java.io.*;
 
class GFG
{
     
static void lengchord(int z)
{
    System.out.println ("The length is "+ z );
}
 
// Driver code
public static void main (String[] args)
{
 
    int z = 48;
    lengchord(z);
}
}
 
// The code has been contributed by ajit.




# Python3 program to find
# the length of the chord of the circle
# if length of the other chord
# which is equally inclined
# through the diameter is given
def lengchord(z):
    print("The length is ", end = "");
    print(z);
 
# Driver code
z = 48;
lengchord(z);
 
# This code is contributed
# by Princi Singh




// C# program to find
// the length of the chord the circle
// if length of the another chord
// which is equally inclined
// through the diameter is given
using System;
 
class GFG
{
         
static void lengchord(int z)
{
    Console.WriteLine("The length is "+ z );
}
 
// Driver code
static public void Main ()
{
         
    int z = 48;
    lengchord(z);
}
}
 
// The code has been contributed by Tushil




<script>
 
// javascript program to find
// the length of the chord the circle
// if length of the another chord
// which is equally inclined
// through the diameter is given
 
 
function lengchord(z)
{
    document.write("The length is "+ z );
}
 
// Driver code
 
var z = 48;
lengchord(z);
 
// This code is contributed by Amit Katiyar
 
</script>

Output: 
The length is 48

 

Time Complexity: O(1)

Auxiliary Space: O(1)


Article Tags :