Advertisement
Guest User

hey

a guest
Sep 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. # include <stdio.h>
  2. # include <math.h>
  3.  
  4. int main(void)
  5. {
  6. double a, b, c;
  7. double r1, r2;
  8. printf("Input coefficient 1:");
  9. scanf("%lf, &a");
  10. printf("Input coefficient 2:");
  11. scanf("%lf, &b");
  12. printf("Input coefficient 3:");
  13. scanf("%lf, &c");
  14. if((pow(b, 2) - 4*a*c) <= 0){
  15.         printf("Error");
  16. }else {
  17.   double v1 = sqrt(pow(b, 2) - 4*a*c);
  18.           r1 = (v1-b)/(2*a);
  19.           r2 = (-v1-b)/(2*a);
  20.           printf("Root1: %lf \n", r1);
  21.           printf("Root2: %lf \n", r2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement