Sum of the series 5 + 55 + 555 + . . up to n terms | function which return the the sum of series ; Driver code
function sumOfSeries ( n ) { return parseInt ( ( 0.6172 * ( Math . pow ( 10 , n ) - 1 ) - 0.55 * n ) ) ; } var n = 2 ; document . write ( sumOfSeries ( n ) ) ;