Hi all,
In my program i have to test for the following condition:
If (Q2-4PR) is not a non-zero square (i.e. √(Q2-4PR) hasn’t got a root
and if its true then i have to print out a certain message.
Does this basically mean if the answer isnt a square number? ie. 1, 2, 4, 9, 16, 25, 36,49 etc..
also how would you go about testing this.
All i can think of is say if x represents (Q2-4PR)... :
if(x != 1 || x != 2 || x != 4 || x != 9 etc...) {
System.out.println("Error message here");
}
Obviously there must be a correct way to test if a number is a square. Would a boolean be involved ?
Any help appreciated.