AI Features

Solution Review: Compute an Expression Using Maths

In this review, the solution of the challenge 'Compute an expression using maths' from the previous lesson is provided.

We'll cover the following...

Solution

Java
class HelloWorld {
public static void main( String args[] ) {
double x = 55.0;
double y = 18.0;
double z = 51.0;
double answer;
double sum = Math.pow(x, 2) + Math.pow(y, 2);
double sub = sum - Math.abs(z);
answer = Math.cbrt(sub);
System.out.println(answer);
}
}

Understanding the Code

...