// Finding the square root of a number
import java.io.*;
class SquareRoot {
public static void main (String[] args) {
// Let's do it with variables this time
double myNum = 2.0;
double theRoot; // assign later
theRoot = Math.sqrt(myNum);
System.out.println("The square root of " + myNum + " is " + theRoot);
} // end main
} // end SquareRoot |