Saturday, July 27, 2013

java Program to Find Square Root of a Number

Program to Find Square Root of a Number
import java.lang.*;
import java.io.*;
class sqrt
{
public static void main(String a[])
{
try
{
DataInputStream dts=new DataInputStream(System.in) ;
System.out.println("enter number to find squaroot");
int m=Integer.parseInt(dts. readLine());
System.out.println("square root
of"+m+"="+Math.sqrt(m));
}
catch(Exception x)
{
System.out.println(x.getMessage());
}
}
}

No comments:

Post a Comment