Java

Program to Find Square Root of a Number

By June 3, 2016 November 9th, 2016 No Comments

/**** Java 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());
}
}
}

Output:





Screenshot (279)

Leave a Reply