Program for n | JAVA program to find the nth odd number ; Function to find the nth odd number ; Driver code
class GFG { static int nthOdd ( int n ) { return ( 2 * n - 1 ) ; } public static void main ( String [ ] args ) { int n = 10 ; System . out . println ( nthOdd ( n ) ) ; } }