Find sum of inverse of the divisors when sum of divisors and the number is given | C ++ implementation of above approach ; Function to return the sum of inverse of divisors ; Calculating the answer ; Return the answer ; Driver code ; Function call
#include <bits/stdc++.h> NEW_LINE using namespace std ; double SumofInverseDivisors ( int N , int Sum ) { double ans = ( double ) ( Sum ) * 1.0 / ( double ) ( N ) ; return ans ; } int main ( ) { int N = 9 ; int Sum = 13 ; cout << setprecision ( 2 ) << fixed << SumofInverseDivisors ( N , Sum ) ; return 0 ; }