Advertisement
PROFESSOR_AIH

bhaskaras formula

Mar 25th, 2022
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<math.h>
  3. int main()
  4.  
  5. {
  6.     double a,b,c,d,r1,r2;
  7.     scanf("%lf %lf %lf",&a,&b,&c);
  8.     if(a==0.000000)
  9.         printf("Impossivel calcular\n");
  10.     else
  11.     {
  12.         d=b*b-4*a*c;
  13.         if(d<0)
  14.             printf("Impossivel calcular\n");
  15.         else
  16.         {
  17.             r1=(-b+sqrt(d))/(2*a);
  18.             r2=(-b-sqrt(d))/(2*a);
  19.             printf("R1 = %.5lf\nR2 = %.5lf\n",r1,r2);
  20.         }
  21.     }
  22.     return 0;
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement