📜  弦的长度为圆,如果给出通过直径相等倾斜的另一个弦的长度

📅  最后修改于: 2021-10-23 09:12:27             🧑  作者: Mango

给定两个弦,它们在圆的直径上同样倾斜。给出了一个和弦的长度。任务是找到另一个和弦的长度。
例子:

Input: z = 48
Output: 48 degrees

Input: z = 93
Output: 93 degrees

方法

  • ABAC为以O为圆心的圆的两条弦。
  • 现在,在我们看到的图中,
    OLAB垂直, OMAC垂直
  • 在三角形OLA和三角形OMA 中
    角度 OLA = 角度 OMA = 90 度
    角度 OAL = 角度 OAM (因为弦在直径上倾斜相等)
    OA = OA (公共端)
  • 所以三角形OLA和三角形OMA是全等的。
  • 所以, OL = OM
  • 我们知道,相等的和弦到中心的距离相等,所以ABAC 的长度将相同。

下面是上述方法的实现:

C++
// 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 
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
// 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
# 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#
// 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


Javascript


输出:
The length is 48

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