Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.45 KB | None | 0 0
  1. #include <math.h>
  2. int masodfoku(double a, double b, double c, double *x1, double *x2)
  3. {
  4.  double d;
  5.  if ( (a!=0) && (d = ((b*b)-4*a*c) )>=0 )
  6.  {
  7.       *x1 = (-1*b+sqrt(d))/(a*2) ;
  8.       *x2 = (-1*b-sqrt(d))/(a*2) ;
  9.       return 1;
  10. } else if (a==0 && b!=0)
  11.          {
  12.              *x1=*x2=(-1*c)/b;
  13.              return 1;            
  14.              } else if (a==0 && b==0 && c==0)
  15.              {*x1=*x2=0; return 1;}
  16.               else return 0;
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement