Ratio of mth and nth terms of an A . P . with given ratio of sums | C ++ code to calculate ratio ; function to calculate ratio of mth and nth term ; ratio will be tm / tn = ( 2 * m - 1 ) / ( 2 * n - 1 ) ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; float CalculateRatio ( float m , float n ) { return ( 2 * m - 1 ) / ( 2 * n - 1 ) ; } int main ( ) { float m = 6 , n = 2 ; cout << CalculateRatio ( m , n ) ; return 0 ; }