Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- float d, F=1, f, a, b, c;
- int main()
- {
- printf("Enter the coefficients of the quadratic equation ax^2 + bx + c = 0");
- printf("\na = ");
- scanf("%f", &a);
- printf("\nb = ");
- scanf("%f", &b);
- printf("\nc = ");
- scanf("%f", &c);
- printf("\n\nEnter a reference point: ");
- scanf("%f", &d);
- printf("\n\n%f %f %f %f", a, b, c, d);
- while(F>0.0001)
- {
- F = a*d*d+b*d+c;
- f = 2*a*d+b;
- d = d - F/f;
- }
- printf("\nOne root is %f", d);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement