Check whether a number can be represented as difference of two squares | C ++ program to check whether a number can be represented by the difference of two squares ; Function to check whether a number can be represented by the difference of two squares ; Checking if n % 4 = 2 or not ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; bool difSquare ( int n ) { if ( n % 4 != 2 ) { return true ; } return false ; } int main ( ) { int n = 45 ; if ( difSquare ( n ) ) { cout << " Yes STRNEWLINE " ; } else { cout << " No STRNEWLINE " ; } return 0 ; }