Times required by Simple interest for the Principal to become Y times itself | C ++ implementation of the approach ; Function to return the no . of years ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float noOfYears ( int t1 , int n1 , int t2 ) { float years = ( ( t2 - 1 ) * n1 / ( float ) ( t1 - 1 ) ) ; return years ; } int main ( ) { int T1 = 3 , N1 = 5 , T2 = 6 ; cout << noOfYears ( T1 , N1 , T2 ) ; return 0 ; }