给定圆弧在圆周圆周X处所对向的角度,任务是找到圆弧在圆心处所对向的角度。
例如,在下面的给定图像中,给定了角度X,必须找到角度Y。
例子:
Input: X = 30
Output: 60
Input: X = 90
Output: 180
方法:
- 当我们绘制半径AD和弦CB时,我们得到三个小三角形。
- 三个三角形ABC,ADB和ACD是等腰,AB,AC和AD是圆的半径。
- 因此,在每个三角形中,每个三角形的两个锐角(s,t和u)相等。
- 从图中我们可以看到
D = t + u (i)
- 在ABC三角形中,
s + s + A = 180 (angles in triangle)
ie, A = 180 - 2s (ii)
- 在三角形BCD中,
(t + s) + (s + u) + (u + t) = 180 (angles in triangle again)
so 2s + 2t + 2u = 180
ie 2t + 2u = 180 - 2s (iii)
- 所以
A = 2t + 2u = 2D from (i), (ii) and (iii)
- 因此证明“中心角是圆周角的两倍”。
下面是上述方法的实现:
C++
// C++ implementation of the approach
#include
using namespace std;
// Function to find Angle
// subtended by an arc
// at the centre of a circle
int angle(int n)
{
return 2 * n;
}
// Driver code
int main()
{
int n = 30;
cout << angle(n);
return 0;
}
Java
// Java implementation of the approach
import java.io.*;
class GFG
{
// Function to find Angle subtended
// by an arc at the centre of a circle
static int angle(int n)
{
return 2 * n;
}
// Driver code
public static void main (String[] args)
{
int n = 30;
System.out.println(angle(n));
}
}
// This code is contributed by ajit.
Python3
# Python3 implementation of the approach
# Function to find Angle
# subtended by an arc
# at the centre of a circle
def angle(n):
return 2 * n
# Driver code
n = 30
print(angle(n))
# This code is contributed by Mohit Kumar
C#
// C# implementation of the approach
using System;
class GFG
{
// Function to find Angle subtended
// by an arc at the centre of a circle
static int angle(int n)
{
return 2 * n;
}
// Driver code
public static void Main()
{
int n = 30;
Console.Write(angle(n));
}
}
// This code is contributed by Akanksha_Rai
Javascript
输出:
60
时间复杂度: O(1)