Answers for "bhaskara's formula in c"

C
0

bhaskara's formula in c

#include <stdio.h>
#include <math.h>
int main()
{
  double a, b, c, r1, r2;
  scanf("%lf %lf %lf", &a, &b, &c);
  r1 = (-b + sqrt(pow(b, 2) - (4 * a * c))) / (2 * a);
  r2 = (-b - sqrt(pow(b, 2) - (4 * a * c))) / (2 * a);
  if ((int)a == 0 || b < c)
  {
    printf("impossible to calculate\n");
  }
  else
  {

    printf("R1 = %0.5lf\n", r1);
    printf("R2 = %0.5lf\n", r2);
  }

  return 0;
}
Posted by: Guest on July-30-2021

Code answers related to "C"

Browse Popular Code Answers by Language