Raising a number to a power in Java

^ in java does not mean to raise to a power. It means XOR.

You can use java’s Math.pow()


And you might want to consider using double instead of int—that is:

double height;
double weight;

Note that 199/100 evaluates to 1.

Leave a Comment