Check if a given number is Pronic | Efficient Approach | C # program to check if a number is pronic or not ; Function to check Pronic Number ; Checking Pronic Number by multiplying consecutive numbers ; Driver Code
using System ; class GFG { static bool pronic_check ( int n ) { int x = ( int ) ( Math . Sqrt ( n ) ) ; if ( x * ( x + 1 ) == n ) return true ; else return false ; } public static void Main ( ) { int n = 56 ; if ( pronic_check ( n ) == true ) Console . Write ( " YES " ) ; else Console . Write ( " NO " ) ; } }