Idoneal Numbers | C ++ implementation for the above approach ; Function to check if number is an Idoneal numbers ; iterate for all triples pairs ( a , b , c ) ; if the condition is satisfied ; Driver Code ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool isIdoneal ( int n ) { for ( int a = 1 ; a <= n ; a ++ ) { for ( int b = a + 1 ; b <= n ; b ++ ) { for ( int c = b + 1 ; c <= n ; c ++ ) { if ( a * b + b * c + c * a == n ) return false ; } } } return true ; } int main ( ) { int N = 10 ; if ( isIdoneal ( N ) ) cout << " Yes " ; else cout << " No " ; return 0 ; }