08.01.2021»»пятница

Dev C++ Quadratic Equation

08.01.2021

Sep 26, 2018  A quadratic equation is in the form ax 2 + bx + c. The roots of the quadratic equation are given by the following formula − There are three cases − b 2 4.a.c - The roots are real and both roots are different. The program to find the roots of a quadratic equation. Feb 13, 2011  Write a C program that solves quadratic equation to find its roots. The roots of a quadratic equation ax2+bx+c=0 (where a is not zero) is given by the formula: x=(-b±√(b^2-4ac))/2a Note:To find the square root of a number, use the function sqrt and include the math library. Where (b^2-4ac) is the discriminant.

  1. Quadratic Equation Solver
  2. Dev C++ Quadratic Equations

I am supposed to write a program that asks for the coefficients a, b, and c of a quadratic equation ax2+bx+c=0. It needs to display to the screen one of the following:
• two distinct real numbers (when b2-4ac > 0),
• two distinct complex numbers (when b2-4ac < 0), or
• one real number (when b2-4ac = 0)

In case anyone reading this doesn't know, quadratic equation is: x = (-b +- sqrt((b^2)-4ac))/2a Now my question is, how would I put that into C in my program? (I haven't started it yet because I want to figure out how to write this equation into it first) Thanks! Implement the function findRoots to find the roots of the quadratic equation: ax 2 + bx + c = 0. The roots of the quadratic equation can be found with the following formula: For example, the roots of the equation 2x 2 + 10x + 8 = 0 are -1 and -4. Mar 23, 2013  Write a C program that solves quadratic equation to find its roots Write a c program to solve quadratic equation C quadratic equation solver Quadratic Equation: C Source Code program to.

Dev c++ free download filehippo. I have worked the following program and it doesn't work when set up this way:

If I change the last statement to 'if else' the program works, but I don't think that would be correct. Please help.

Edited by WaltP: Added CODE tags -- with all the help about them, how could you miss using them????
  • 3 Contributors
  • forum 4 Replies
  • 827 Views
  • 7 Hours Discussion Span
  • commentLatest Postby abhimanipalLatest Post

Dave Sinkula2,398

I am supposed to write a program that asks for the coefficients a, b, and c of a quadratic equation ax2+bx+c=0. It needs to display to the screen one of the following:
• two distinct real numbers (when b2-4ac > 0),
• two distinct complex numbers (when b2-4ac < 0), or
• one real number (when b2-4ac = 0)

I have worked the following program and it doesn't work when set up this way:

Quadratic formula

If I change the last statement to 'if else' the program works, but I don't think that would be correct. Please help.

It's a syntax error as written, and won't compile, so it can't be run. Why would you think this is more correct?

You're also not declaring a, b, and c. Please post actual code and wrap it in code tags.

Quadratic Equation Solver

It would be less redundant to use a temporary, say

Dev C++ Quadratic Equations

instead of recalculating it several times. It is also cleaner, clearer, and easier to read.