Simple and Comprehensive Java Programs
Labels
Armstrong
(1)
Array
(1)
Celsius to Fahrenheit
(1)
Commandline
(4)
even odd
(1)
Factorial
(1)
Fibonacci
(1)
Hello World
(1)
Java.Lang.Math
(1)
java.util.Arrays
(1)
Java.Util.Scanner
(3)
Reverse of number
(1)
Rhombus
(1)
Square Root
(1)
Table
(1)
Showing posts with label
Square Root
.
Show all posts
Showing posts with label
Square Root
.
Show all posts
Wednesday, 18 September 2013
Java Program to find Square Root of a number through Commandline
import java.lang.Math;
class Squareroot
{
public static void main (String args[])
{
float num,sqnum;
num = Float.valueOf(args[0]).floatValue();
sqnum = (float)Math.sqrt(num);
System.out.println("Square Root of "+num+" is "+sqnum);
}
}
Output:
Older Posts
Home
Subscribe to:
Posts (Atom)