Advertisement
yurifelix

Bascara - c

Feb 14th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. main(){
  2.  
  3. double a,b,c,x1,x2,d;
  4.  
  5. scanf("%lf %lf %lf",&a,&b,&c,&d);
  6.  
  7. d = pow(b,2) - (4 * a * c );
  8.  
  9. if((a==0) || d<0){
  10. printf("Impossivel calcular\n");
  11. }
  12. else{
  13. x1 = (-b + sqrt(d) ) / (2 * a);
  14. x2 = (-b - sqrt(d) ) / (2 * a);
  15.  
  16. printf("R1 = %.5lf\n",x1);
  17. printf("R2 = %.5lf\n",x2);
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement