Niloy007

Problem 1

Apr 11th, 2021
484
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. int main() {
  5.     double a, b, c;
  6.     scanf("%lf %lf %lf", &a, &b, &c);
  7.  
  8.     double x = sqrt((b * b) - (4 * a * c));
  9.     double res1 = (-b + x) / (2 * a);
  10.     double res2 = (-b - x) / (2 * a);
  11.  
  12.     printf("X1 = %.3lf\nX2 = %.3lf\n", res1, res2);
  13. }
RAW Paste Data