📜  给定中心与另一个等长弦之间的距离时和弦与中心的距离

📅  最后修改于: 2021-05-04 10:48:17             🧑  作者: Mango

给定一个圆的两个相等长度的和弦,以及中心与一个和弦之间的距离。这里的任务是找到中心和其他和弦之间的距离。
例子:

Input: 48
Output: 48


Input: 82
Output: 82

下面是上述方法的实现:
方法
ABCD为以O为中心的圆的两个相等的和弦。 OM是和弦AB距中心的给定距离。
现在处于三角形AOMCON中
OA = OC (同一圆的半径)
MA = CN (因为OM和ON与弦垂直,并且将弦二等分,并且AM = MB和CN = CD)
角度AMO =角度ONC = 90度
所以三角形是全等的
因此, OM = ON

下面是上述方法的实现:

C++
// C++ program to find the distance of chord
// from center when distance between center
// and another equal length chord is given
 
#include 
using namespace std;
 
void lengequichord(int z)
{
    cout << "The distance between the "
         << "chord and the center is "
         << z << endl;
}
 
// Driver code
int main()
{
    int z = 48;
    lengequichord(z);
    return 0;
}


Java
// Java program to find the distance of chord
// from center when distance between center
// and another equal length chord is given/
 
import java.io.*;
 
class GFG
{
     
static void lengequichord(int z)
{
    System.out.println ("The distance between the "+
    "chord and the center is "+ z );
}
 
// Driver code
public static void main (String[] args)
{
 
    int z = 48;
    lengequichord(z);
}
}
 
// This code is contributed by jit_t.


Python 3
# Python 3 program to find the distance of chord
# from center when distance between center
# and another equal length chord is given
 
def lengequichord(z):
    print("The distance between the" ,
          "chord and the center is" , z )
 
# Driver code
if __name__ == "__main__":
    z = 48
    lengequichord(z)
 
# This code is contributed
# by ChitraNayal


C#
// C# program to find the distance of chord
// from center when distance between center
// and another equal length chord is given
using System;
 
class GFG
{
     
    static void lengequichord(int z)
    {
        Console.WriteLine("The distance between the "+
        "chord and the center is "+ z );
    }
     
    // Driver code
    public static void Main ()
    {
     
        int z = 48;
        lengequichord(z);
    }
}
 
// This code is contributed by AnkitRai01


Javascript


输出:
The distance between the chord and the center is 48