Question:

Square roots in java.?

by  |  earlier

0 LIKES UnLike

Does anyone know how to make an equation with square roots in java.

I am trying to make programs that solve formulas.

ex: d=rt

I want the user to enter r and t and have it solve for d.

I know about the Math Class, but how do I use the square root function?

Isn't there something that you start with like import java.math or something like that?

 Tags:

   Report

1 ANSWERS


  1. You can say

    double rt = Math.sqrt(25) for example.

    You could also use:

    import static java.lang.Math.*;

    then you could use

    double rt = sqrt(25);

You're reading: Square roots in java.?

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.