0
I need to know if the sum of two numbers is a perfect square, I thought of adding the two and take the root and then check if the rest of the division by 1 is greater than zero, only the operator (%) only works with integers and sqrt does not return me in int, someone has a better idea or knows how to build my own MOD function?
if(sqrt(a+b)%1==0) ...
What is the language?
– ramaral
I’m using the liguagem c
– Wendell Ferreira dos Santos
int tentativa = sqrt(valor); if (tentativa * tentativa == valor) /* quadrado perfeito */;
– pmg