Updated on Kisan Patel
To convert a value in degrees to radians, multiply it by math.PI/180
:
public static double ConvertDegreesToRadians (double degrees) { return ((Math.PI / 180) * degrees); }
To convert a value in radians to degrees, multiply it by 180/mathPI
:
public static double ConvertRadiansToDegrees(double radians) { return ((180 / Math.PI) * radians); }
Example
class Program { static void Main(string[] args) { double degrees = 180; double radians = 3.14; Console.WriteLine("Degrees To Radians = " + ConvertDegreesToRadians(degrees)); Console.WriteLine("Radians To Degrees = " + ConvertRadiansToDegrees(radians)); Console.ReadKey(); } public static double ConvertDegreesToRadians(double degrees) { return ((Math.PI / 180) * degrees); } public static double ConvertRadiansToDegrees(double radians) { return ((180 / Math.PI) * radians); } }
Output of the above program…