In java...
public boolean checkSquare(int n){
int actualNumber = n;
int squareRoot = (int)Math.sqrt(n);
int squaredNumber = Math.pow(squareRoot,2);
if(squaredNumber==actualNumber){
return true;
} else {
return false;
}
}
Learning
planning
designing
developing
testing delivering
Equality and Relational Operators
For the statement to return false, you can simply use the "not equal to" equality operation. The full symbol of this operation is '!=', disregarding the quotes.
<u>Examples:</u>
- [1 != 1] would produce FALSE. Translation: 1 <u>does not equal</u> 1?
- [1 == 1] would produce TRUE. Translation: 1 <u>does</u> 1?
- ["G" != "G] would produce <u>FALSE</u>. Translation: "G" <u>does not equal</u> "G"?
CONCLUSION: Use "!=".