Advertisement
rony-Rony_05

Untitled

Jul 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3. int main() {
  4.     int x, a, b, c;
  5.     double ans;
  6.     scanf("%d %d %d %d",&x,&a,&b,&c);
  7.     if(x < 0){
  8.         printf("We can find the value of x using Bashkara's Formula.\n");
  9.         return 0;
  10.      }
  11.     else if(a < 0) ans = (-(c / x) - b) / x;
  12.     else if(b < 0) ans = (-(a * x) - (c / x));
  13.     else if(c < 0) ans = -((a * x * x) + (b * x));
  14.     printf("%.2lf\n", ans);
  15.  
  16.     return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement