Function to print the sum of the series
static float sum ( int x , int n ) { double i , total = 1.0 ; for ( i = 1 ; i <= n ; i ++ ) total = total + ( Math . Pow ( x , i ) / i ) ; return ( float ) total ; }