Program to check if N is a Decagonal Number | Python3 program for the above approach ; Function to check if N is a decagonal number ; Condition to check if the number is a decagonal number ; Driver Code ; Given number ; Function Call
import math NEW_LINE def isdecagonal ( N ) : NEW_LINE INDENT n = ( 3 + math . sqrt ( 16 * N + 9 ) ) / 8 NEW_LINE return ( n - int ( n ) ) == 0 NEW_LINE DEDENT if __name__ == ' _ _ main _ _ ' : NEW_LINE INDENT N = 10 NEW_LINE if isdecagonal ( N ) : NEW_LINE INDENT print ( ' Yes ' ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( ' No ' ) NEW_LINE DEDENT DEDENT