text: Count of numbers of length N having prime numbers at odd indices and odd numbers at even indices | c ++ program to Count of numbers of length N having prime numbers at odd indices and odd numbers at even indices ; function to find total number of ways ; No of odd indices in n - digit number ; No of even indices in n - digit number ; No of ways of arranging prime number digits in odd indices ; No of ways of arranging odd number digits in even indices ; returning the total number of ways ; drive code
code: #include <bits/stdc++.h> NEW_LINE using namespace std ; int find_Numb_ways ( int n ) { int odd_indices = n / 2 ; int even_indices = ( n / 2 ) + ( n % 2 ) ; int arr_odd = pow ( 4 , odd_indices ) ; int arr_even = pow ( 5 , even_indices ) ; return arr_odd * arr_even ; } int main ( ) { int n = 4 ; cout << find_Numb_ways ( n ) << endl ; return 0 ; }