heey all ,,
I'v a question about the pow ,, but when I run the programe it didn't work =S
I really need help because tomorrow I shloud give it to my teacher,,

********************************************
import java.lang.Math;
public class ques3
{
public static void main(String[]args)
{
static Scanner console = new Scanner(System.in);
float a,b,c;
System.out.println("Enter a ");
a=console.nextFloat();
System.out.println("Enter b ");
b=console.nextFloat();
System.out.println("Enter c ");
c=console.nextFloat();
sum=Math.Pow((double)b*b-4*a*c,0.5);

Recommended Answers

All 6 Replies

"It didn't work" is not a question.

And use code tags if you post code.

3. Write expressions to compute both solutions for the quadratic formula. The formula is (b^2-4ac)^0.5

The symbol means “plus or minus” and indicates that the equation has two solutions: one in which the result of the square root is added to -b and one in which the result is subtracted from -b. Assume all variables are float variables.

this it the question ,,

And what is your question? As I said, "it doesn't work" is not a question. Be specific.

oh !!
please I asked for help be kind with me =S

my question is : what is the wrong in my code ?! why it doesn't run ?!

hope am clear

The compiler is usually very explicit in telling you what the problem is.

At a quick glance, one problem is that you used "Pow" instead of "pow". Java is case sensitive .

ok I correct it ,,
but just one more question ,,
in the statment :

System.out.println("the value="+sum);

how can I say before this statment ?
sum=console.nextdouble ?!
or what ?!

sorry but I'm not a perfect in java

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.