Sum of the series 5 + 55 + 555 + . . up to n terms | Java program for sum of the series 5 + 55 + 555. . ... n ; function which return the the sum of series ; Driver code
class GFG { static int sumOfSeries ( int n ) { return ( int ) ( 0.6172 * ( Math . pow ( 10 , n ) - 1 ) - 0.55 * n ) ; } public static void main ( String [ ] args ) { int n = 2 ; System . out . println ( sumOfSeries ( n ) ) ; } }