text: Find Range Value of the Expression | C ++ 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
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; double get ( double L , double R ) { double x = 1.0 / L ; double y = 1.0 / ( R + 1.0 ) ; return ( x - y ) ; } int main ( ) { int L = 6 , R = 12 ; double ans = get ( L , R ) ; cout << fixed << setprecision ( 2 ) << ans ; return 0 ; }