lundi 23 novembre 2015

Java if statement multiples

I have a statement

if(x !=0 && x!= n && x!= 2*n .... x!= n*n){ ....

I want to know if there is a better way of writing this code instead of this long form. The code basically checks if X is not equal to the multiplication of n and any natural number(0-N). in java.

Aucun commentaire:

Enregistrer un commentaire