Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

how to check sqrt of number is integer c++

bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 
 
PREVIOUS NEXT
Tagged: #check #sqrt #number #integer
ADD COMMENT
Topic
Name
5+8 =