Sum of the sequence 2 , 22 , 222 , ... ... ... | JAVA Code for Sum of the sequence 2 , 22 , 222 , ... ; function which return the the sum of series ; Driver program
import java . util . * ; class GFG { static double sumOfSeries ( int n ) { return 0.0246 * ( Math . pow ( 10 , n ) - 1 - ( 9 * n ) ) ; } public static void main ( String [ ] args ) { int n = 3 ; System . out . println ( sumOfSeries ( n ) ) ; } }