📜  当给定中心与另一个等长弦的距离时,弦距中心的距离

📅  最后修改于: 2021-10-23 08:07:31             🧑  作者: 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

如果您希望与专家一起参加现场课程,请参阅DSA 现场工作专业课程学生竞争性编程现场课程