Program to find the rate percentage from compound interest of consecutive years | Java implementation of the approach ; Function to return the required rate percentage ; Driver code
class GFG { static int Rate ( int N1 , int N2 ) { float rate = ( N2 - N1 ) * 100 / N1 ; return ( int ) rate ; } public static void main ( String [ ] args ) { int N1 = 100 , N2 = 120 ; System . out . println ( Rate ( N1 , N2 ) + " ▁ % " ) ; } }