Check whether the number can be made perfect square after adding K | C ++ program to check whether the number can be made perfect square after adding K ; Function to check whether the number can be made perfect square after adding K ; Computing the square root of the number ; Print Yes if the number is a perfect square ; Driver code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void isPerfectSquare ( long long int x ) { long double sr = round ( sqrt ( x ) ) ; if ( sr * sr == x ) cout << " Yes " ; else cout << " No " ; } int main ( ) { int n = 7 , k = 2 ; isPerfectSquare ( n + k ) ; return 0 ; }