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
using System ; using System . Collections . Generic ; class GFG { static int find_Numb_ways ( int n ) { int odd_indices = n / 2 ; int even_indices = ( n / 2 ) + ( n % 2 ) ; int arr_odd = ( int ) Math . Pow ( 4 , odd_indices ) ; int arr_even = ( int ) Math . Pow ( 5 , even_indices ) ; return arr_odd * arr_even ; } public static void Main ( ) { int n = 4 ; Console . Write ( find_Numb_ways ( n ) ) ; } }