All possible numbers of N digits and base B without leading zeros | C ++ implementation of the approach ; function to count all permutations ; count of all permutations ; count of permutations with leading zeros ; Return the permutations without leading zeros ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void countPermutations ( int N , int B ) { int x = pow ( B , N ) ; int y = pow ( B , N - 1 ) ; cout << x - y << " STRNEWLINE " ; } int main ( ) { int N = 6 ; int B = 4 ; countPermutations ( N , B ) ; return 0 ; }