Sum of N terms in the expansion of Arcsin ( x ) | Java implementation of the approach ; Function to find the arcsin ( x ) ; The power to which ' x ' is raised ; Numerator value ; Denominator value ; Driver code
import java . io . * ; class GFG { static void find_Solution ( double x , int n ) { double sum = x , e = 2 , o = 1 , p = 1 ; for ( int i = 2 ; i <= n ; i ++ ) { p += 2 ; sum += ( double ) ( o / e ) * ( double ) ( Math . pow ( x , p ) / p ) ; o = o * ( o + 2 ) ; e = e * ( e + 2 ) ; } System . out . println ( sum ) ; } public static void main ( String [ ] args ) { double x = - 0.5 ; if ( Math . abs ( x ) >= 1 ) { System . out . println ( " Invalid ▁ Input " ) ; } int n = 8 ; find_Solution ( x , n ) ; } }