Check if a number has an odd count of odd divisors and even count of even divisors | C ++ implementation of the above approach ; Function to check if the number is a perfect square ; Find floating point value of square root of x . ; If square root is an integer ; Function to check if count of even divisors is even and count of odd divisors is odd ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; #define lli  long long int NEW_LINE bool isPerfectSquare ( long double x ) { long double sr = sqrt ( x ) ; return ( ( sr - floor ( sr ) ) == 0 ) ; } void checkFactors ( lli N ) { if ( isPerfectSquare ( N ) ) cout << " Yes " << endl ; else cout << " No " << endl ; } int main ( ) { lli N = 36 ; checkFactors ( N ) ; return 0 ; }