Author : MD TAREQ HASSAN | Updated : 2021/03/22

Math functions

var foo = 9;
var sqrtVal = Math.Sqrt(foo);
Console.WriteLine(sqrtVal);

var foo = 3;
var powVal = Math.Pow(foo, 2);
Console.WriteLine(powVal);

var foo = -15;
var absoluteVal = Math.Abs(foo);
Console.WriteLine(absoluteVal);

Radian-Degree Conversion

var deg = 120;
var radians = deg * (Math.PI / 180);
Console.WriteLine(radians);

var degrees = radians * (180 / Math.PI);
degrees = Math.Round(degrees, 2);
Console.WriteLine(degrees);