Find the Kth number which is not divisible by N | Java implementation to find the K 'th non-divisible number of N ; Function to find the Kth not divisible by N ; Driver Code ; Function Call
class GFG { static int kthNonDivisible ( int N , int K ) { return ( int ) ( K + Math . floor ( ( K - 1 ) / ( N - 1 ) ) ) ; } public static void main ( String [ ] args ) { int N = 3 ; int K = 6 ; System . out . print ( kthNonDivisible ( N , K ) ) ; } }