tags:

views:

171

answers:

5
 System.out.println("find the value of c if:");
 Scanner kbreader=new Scanner(System.in);
 System.out.print("a="+" ");
 double a=kbreader.nextDouble();
 System.out.print("b=" + " ");
 double b=kbreader.nextDouble();
 System.out.print("c=" + " " );
 System.out.print((a*a)+(b*b));
+9  A: 

What's wrong with Math.sqrt(double)?

Prasoon Saurav
sorry but im only 2ndyr. not very familiar with this and not so talented to do some programs. LoL/ ;) where do i put the math.sqrt? thanks in advance :)
jhoanne
Pythagoras' formula right? `System.out.print(Math.sqrt((a*a)+(b*b)));` should work.
Prasoon Saurav
sorry for this lil' kind of Question. :) thanks to you. maybe my code before is not complete so it makes error everytime i command to run it.i use that code also but it not works maybe i forgot to put somethine ;). thanks a lot again. God Bless ;)
jhoanne
+5  A: 

Math.sqrt(double)

If you're going to program much in Java you'll want to get familiar with the core libraries. The Java Tutorials is a good place to start.

Bill the Lizard
thanks for info. :) Good Day to you ;)
jhoanne
+3  A: 

Look at the Math class: http://download.oracle.com/javase/6/docs/api/java/lang/Math.html

Andy White
thanks for info. :) Good Day to you ;)
jhoanne
A: 

I don't understand, what's wrong with the standard sqrt function?

Mike G.
Perhaps sqrt is not allowed in homework...
Nivas
thanks for info. :) Good Day to you ;)
jhoanne
A: 

Math.sqrt(double)

Bruno
http://download.oracle.com/javase/tutorial/
jhoanne