Program To Find Square Root Of An Integer In Java
//Program Starts Hereimport java.io.*;
class sqr
{
public static void main(String arg[]) throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter A number to find its Square Root: ");
double num=Double.parseDouble(br.readLine());
if(num<0)
{
double i;
i=-num;
System.out.print("\nSquare root of "+num+" is: "+(Math.sqrt(i))+"i \nwhere i stands for iota\n");
}
else
{
System.out.print("\nSquare root of "+num+" is: "+(Math.sqrt(num))+"\n");
}
}
}
//Program Ends Here
For More Java Programs Click Here
Thanks For Visiting...
No comments:
Post a Comment