The length of a rectangle is stored in a double variable named length, the width in one named width. Write an expression whose value is the length of the diagonal of the rectangle.

2
The length of a rectangle is stored in a double variable named  length, the width in one named width. Write an expression whose value is the length of the diagonal of the rectangle.

LANGUAGE: JAVA

CHALLENGE:

The length of a rectangle is stored in a double variable named length, the width in one named width. Write an expression whose value is the length of the diagonal of the rectangle.

SOLUTION:

Math.sqrt(Math.pow(length,2) + Math.pow(width,2))

2 comments

Add comment