Program to find the rate percentage from compound interest of consecutive years | C ++ implementation of the approach ; Function to return the required rate percentage ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float Rate ( int N1 , int N2 ) { float rate = ( N2 - N1 ) * 100 / float ( N1 ) ; return rate ; } int main ( ) { int N1 = 100 , N2 = 120 ; cout << Rate ( N1 , N2 ) << " ▁ % " ; return 0 ; }