Find the sum of series 0. X + 0. XX + 0. XXX + ... upto k terms | Java program for sum of the series 0. x , 0. xx , 0. xxx , ... upto k terms ; function which return the sum of series ; Driver code
public class GFG { static float sumOfSeries ( int x , int k ) { float y = ( float ) ( ( ( float ) ( x ) / 81 ) * ( 9 * k - 1 + Math . pow ( 10 , ( - 1 ) * k ) ) ) ; return y ; } public static void main ( String args [ ] ) { int x = 9 ; int k = 20 ; System . out . println ( sumOfSeries ( x , k ) ) ; } }