Over 500 Magazines for FREE!

Yes! You can subscribe to ALL of them. They will be shipped to your home FREE of cost!
Kindly click here to apply!

Wrapper Classes And Other Classes Of java.lang Package

Math.sqrt()

what if i wanted to find the square root of a previously supplied integer which is now saved in a string.

Toni

Please show examples with GUI...ur site is the best so far for Java...

square root of a integer saved in a string.

  1. import java.lang.Math;
  2. public class Find_sqrt
  3. {
  4. public static void main(String s[]){
  5. String s="23";
  6. int i=Integer.parseInt(s);
  7. int result=Math.sqrt(i);
  8. System.out.println("Square root of "+i+" : "+result);
  9. }
  10. }

Post new comment

To combat spam, please enter the code in the image.




Do you have a better example?
We're sure you have hundreds of Java program examples.

Spare some time and submit your java example here even if you think it's too small to contribute.

Could not find what you are looking for? Search Java Examples




Feel Tired? Read Jokes & Inspirational Stories, Play Games!