how to check sqrt of number is integer c 2b 2b

Solutions on MaxInterview for how to check sqrt of number is integer c 2b 2b by the best coders in the world

showing results for - "how to check sqrt of number is integer c 2b 2b"
Yannick
24 Jun 2017
1bool isPerfectSquare(long double x) 
2{   
3  // Find floating point value of  
4  // square root of x. 
5  long double sr = sqrt(x); 
6  
7  // If square root is an integer 
8  return ((sr - floor(sr)) == 0); 
9}