text: Check if N can be obtained from 1 by repetitively multiplying by 10 or 20 | C # program to check if N can be obtained from 1 by repetitive multiplication by 10 or 20 ; Function to check if N can be obtained or not ; Count and remove trailing zeroes ; Check if remaining N is a power of 2 ; To check the condition to prlong YES or NO ; Driver Code
code: using System ; class GFG { static void Is_possible ( long N ) { long C = 0 ; long D = 0 ; while ( N % 10 == 0 ) { N = N / 10 ; C += 1 ; } if ( Math . Pow ( 2 , ( long ) ( Math . Log ( N ) / ( Math . Log ( 2 ) ) ) ) == N ) { D = ( long ) ( Math . Log ( N ) / ( Math . Log ( 2 ) ) ) ; if ( C >= D ) Console . WriteLine ( " YES " ) ; else Console . WriteLine ( " NO " ) ; } else Console . WriteLine ( " NO " ) ; } public static void Main ( ) { long N = 2000000000000L ; Is_possible ( N ) ; } }