C#中如何開根號
C#中如何開根號
慕桂英3389331
2018-11-27 05:05:44
TA貢獻1784條經(jīng)驗 獲得超8個贊
c#中使用開平方函數(shù)
line=System.Math.Sqrt((ending.x-starting.x)*(ending.x-starting.x)+(ending.y-starting.y)*(ending.y-starting.y));
具體方式:
Console.WriteLine(Math.Sqrt(2.0)); //1.4142135623731
Console.WriteLine(Math.Pow(2, 2)); //4
Console.WriteLine(Math.Pow(9, 0.5)); //3
Console.WriteLine(Math.Pow(125, (1.0/3.0))); //5
舉報