Advertisement
Avdluna

URI 1036

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