Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. float d, F=1, f, a, b, c;
  4.  
  5. int main()
  6. {
  7. printf("Enter the coefficients of the quadratic equation ax^2 + bx + c = 0");
  8. printf("\na = ");
  9. scanf("%f", &a);
  10. printf("\nb = ");
  11. scanf("%f", &b);
  12. printf("\nc = ");
  13. scanf("%f", &c);
  14. printf("\n\nEnter a reference point: ");
  15. scanf("%f", &d);
  16. printf("\n\n%f %f %f %f", a, b, c, d);
  17.  
  18. while(F>0.0001)
  19. {
  20. F = a*d*d+b*d+c;
  21. f = 2*a*d+b;
  22. d = d - F/f;
  23.  
  24. }
  25.  
  26. printf("\nOne root is %f", d);
  27.  
  28. getch();
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement