Program to check if N is a Star Number | C # implementation to check that a number is a star number or not ; Function to check that the number is a star number ; Condition to check if the number is a star number ; Driver code ; Function call
using System ; class GFG { static bool isStar ( int N ) { double n = ( 6 + Math . Sqrt ( 24 * N + 12 ) ) / 6 ; return ( n - ( int ) n ) == 0 ; } public static void Main ( ) { int i = 13 ; if ( isStar ( i ) ) { Console . WriteLine ( " Yes " ) ; } else { Console . WriteLine ( " No " ) ; } } }