java - How to take the square of a number in Android -
I'm trying to create a number squad (for example, x ^ 2) in the Android code, Error:
Operator ^ Logic type (s) int, Boolean
is undefined for a different way for a number / variable class in Android?
Do this as you do in core Java. Math.pow (yournumber, power)
works yournumber ^ power
.
import java.lang *; Public class MathDemo {public static zero main (string [] args) {// two double numbers double X = 2.0; Double y = 5.4; // printed by x and then y system.out.println ("Math.pow (" + x + "," + y + ") =" + + Math.pow (x, y) ; / / X ^ Y system out. Printline (works like "MathPo (" + y + "," + x + ") =" + Math. Pow (y, x)); y ^ x} }
Comments
Post a Comment