Probability that a N digit number is palindrome | C ++ code of above approach ; Find the probability that a n digit number is palindrome ; Denominator ; Assign 10 ^ ( floor ( n / 2 ) ) to denominator ; Display the answer ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void solve ( int n ) { int n_2 = n / 2 ; string den ; den = "1" ; while ( n_2 -- ) den += '0' ; cout << 1 << " / " << den << " STRNEWLINE " ; } int main ( ) { int N = 5 ; solve ( N ) ; return 0 ; }