Ratio of mth and nth terms of an A . P . with given ratio of sums | Java 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
import java . io . * ; class Nth { static float CalculateRatio ( float m , float n ) { return ( 2 * m - 1 ) / ( 2 * n - 1 ) ; } } class GFG { public static void main ( String [ ] args ) { float m = 6 , n = 2 ; Nth a = new Nth ( ) ; System . out . println ( a . CalculateRatio ( m , n ) ) ; } }