Sum of the series 0.6 , 0.06 , 0.006 , 0.0006 , ... to n terms | java program to find sum of 0.6 , 0.06 , 0.006 , 0.0006 , ... to n terms ; function which return the the sum of series ; Driver code
import java . io . * ; class GFG { static double sumOfSeries ( int n ) { return ( 0.666 ) * ( 1 - 1 / Math . pow ( 10 , n ) ) ; } public static void main ( String [ ] args ) { int n = 2 ; System . out . println ( sumOfSeries ( n ) ) ; } }