Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<math.h>
- #include<conio.h>
- //Quadratic equation
- int main()
- {
- // standard formula ax2 + bx + c = 0
- /*the special Quadratic Formula:
- x = [ -b (+-) sqrt(b^2 - 4ac) ] / 2a */
- double a,b,c,d,x1,x2;
- printf("Enter a,b,c:\n");
- scanf("%lf %lf %lf",&a,&b,&c);
- d=sqrt(b*b-4*a*c);
- x1=(-b+d)/(2*a);
- x2=(-b-d)/(2*a);
- printf("x1=%.0lf\n",x1);
- printf("x2=%.0lf",x2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement