Find Range Value of the Expression | Java implementation of the approach ; Function to return the value of the given expression ; Value of the first term ; Value of the last term ; Driver code ; Get the result
import java . util . * ; class GFG { static double get ( double L , double R ) { double x = 1.0 / L ; double y = 1.0 / ( R + 1.0 ) ; return ( x - y ) ; } public static void main ( String [ ] args ) { int L = 6 , R = 12 ; double ans = get ( L , R ) ; System . out . printf ( " % .2f " , ans ) ; } }