Program to convert polar co | Function to convert degree to radian ; Function to convert the polar coordinate to cartesian ; Convert degerees to radian ; Applying the formula : x = rcos ( theata ) , y = rsin ( theta ) ; Print cartesian coordinates ; Given polar coordinates ; Function to convert polar coordinates to equivalent cartesian coordinates
function ConvertDegToRad ( degree ) { let pi = 3.14159 ; return ( degree * ( pi / 180.0 ) ) ; } function ConvertToCartesian ( polar ) { polar [ 1 ] = ConvertDegToRad ( polar [ 1 ] ) ; let cartesian = [ polar [ 0 ] * Math . cos ( polar [ 1 ] ) , polar [ 0 ] * Math . sin ( polar [ 1 ] ) ] ; document . write ( ( cartesian [ 0 ] ) . toFixed ( 3 ) + " " + ( cartesian [ 1 ] ) . toFixed ( 3 ) ) ; } let polar = [ 1.4142 , 45 ] ; ConvertToCartesian ( polar ) ;