Check if a given number is Pronic | Efficient Approach | C / 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
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool pronic_check ( int n ) { int x = ( int ) ( sqrt ( n ) ) ; if ( x * ( x + 1 ) == n ) return true ; else return false ; } int main ( void ) { int n = 56 ; pronic_check ( n ) == true ? cout << " YES " : cout << " NO " ; return 0 ; }