# "C language" to find the root of the equation ax^2+bx+c=0, respectively, consider: 1, there are two unequal real roots 2, there are two equal real roots

Source: Internet
Author: User

`To find the root of the equation ax^2+bx+c=0, consider respectively: 1, there are two unequal real roots 2, there are two equal real roots # include <stdio.h> #include <math.h>int main () {int d;int A, B,c;double x,y;double f;printf ("Please enter A,b,c:"), scanf ("%d%d%d", &a,&b,&c);d = B*b-4*a*c;f = sqrt (d); if (d > 0 {x = ((-1) * B + f)/(2 * a); y = ((-1) * b-f)/(2 * a); printf ("There are two real roots: x =%f y =%f\n", x, y);} else if (d = = 0) {x = ((-1) * b)/(2 * a);p rintf ("This equation has only one real roots: x = y =%f\n", x);} elseprintf ("This equation has no real roots \ n"); return 0;}  `

"C language" to find the root of the equation ax^2+bx+c=0, respectively, consider: 1, there are two unequal real roots 2, there are two equal real roots

Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.