Find the Kth number which is not divisible by N | C ++ implementation to find the K 'th non-divisible number of N ; Function to find the Kth not divisible by N ; Driver Code ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; int kthNonDivisible ( int N , int K ) { return K + floor ( ( K - 1 ) / ( N - 1 ) ) ; } int main ( ) { int N = 3 ; int K = 6 ; cout << kthNonDivisible ( N , K ) ; return 0 ; }