Find Nth number in a sequence which is not a multiple of a given number | C # program for the above approach ; Function to find Nth number not a multiple of A in range [ L , R ] ; Calculate the Nth no ; Check for the edge case ; Driver code ; Input parameters ; Function Call
using System ; class GFG { static void countNo ( int A , int N , int L , int R ) { int ans = L - 1 + N + ( ( N - 1 ) / ( A - 1 ) ) ; if ( ans % A == 0 ) { ans = ans + 1 ; } Console . WriteLine ( ans ) ; } static void Main ( ) { int A = 5 , N = 10 , L = 4 , R = 20 ; countNo ( A , N , L , R ) ; } }