You are viewing a single comment's thread. Return to all comments →
why do we need int before Math.pow
You are using
to find a power of value of the result variable using
which returns a double value as a library method. You thus need to cast it to an int in order for it to work/compile. You will get a casting error otherwise.
pow() takes both of its arguments as double.
pow() results in double
That implies type casting
that int is needed for type casting or for converting double data type to int type , as we know that Math funcction is of double..