如何使用 C# 將三角函式角轉換為弧度?


若要將三角函式角轉換為弧度,請乘以 Math.PI/180。這將將角度轉換為弧度。

以下是程式碼 -

示例

using System;

class Program {
   static void Main() {
      Console.WriteLine(Math.Cos(45));

      double res = Math.Cos(Math.PI * 45 / 180.0);
      Console.WriteLine(res);

   }
}

在上面,我們使用以下公式進行轉換 -

Math.PI * angle / 180.0

更新於: 2020 年 6 月 21 日

3K+ 次觀看

開啟你的職業生涯

透過完成課程獲得認證

開始
廣告
© . All rights reserved.