How to determine the square root of a number in java.
Wednesday, March 18, 2009
import java.io.*; import java.lang.Math; class rootR { public static void main(String args[])throws IOException { String a;int b;double r; BufferedReader ob=new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter the number "); a=ob.readLine(); b=Integer.parseInt(a); r=Math.sqrt(b); System.out.println("Root="+r); } }
0 comments:
Post a Comment