Equation of a straight line with perpendicular distance D from origin and an angle A between the perpendicular from origin and x | C # program for the approach ; Function to find equation of a line whose distance from origin and angle made by the perpendicular from origin with x - axis is given ; Convert angle from degree to radian ; Handle the special case ; Calculate the sin and cos of angle ; Print the equation of the line ; Driver Code ; Given Input ; Function Call
using System ; class GFG { static void findLine ( int distance , float degree ) { float x = ( float ) ( degree * 3.14159 / 180 ) ; if ( degree > 90 ) { Console . WriteLine ( " Not ▁ Possible " ) ; return ; } float result_1 = ( float ) ( Math . Sin ( x ) ) ; float result_2 = ( float ) ( Math . Cos ( x ) ) ; Console . WriteLine ( result_2 . ToString ( "0.00" ) + " x ▁ + " + result_1 . ToString ( "0.00" ) + " y ▁ = ▁ " + distance ) ; } static void Main ( ) { int D = 10 ; float A = 30 ; findLine ( D , A ) ; } }