Count of pairs of integers whose difference of squares is equal to N | C ++ program for the above approach ; Function to find the integral solutions of the given equation ; Initialise count to 0 ; Iterate till sqrt ( N ) ; If divisor 's pair sum is even ; Print the total possible solutions ; Driver Code ; Given number N ; Function Call
#include <bits/stdc++.h> NEW_LINE using namespace std ; void findSolutions ( int N ) { int count = 0 ; for ( int i = 1 ; i <= sqrt ( N ) ; i ++ ) { if ( N % i == 0 ) { if ( ( i + N / i ) % 2 == 0 ) { count ++ ; } } } cout << 4 * count << endl ; } int main ( ) { int N = 80 ; findSolutions ( N ) ; return 0 ; }