Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- int masodfoku(double a, double b, double c, double *x1, double *x2)
- {
- double d;
- if ( (a!=0) && (d = ((b*b)-4*a*c) )>=0 )
- {
- *x1 = (-1*b+sqrt(d))/(a*2) ;
- *x2 = (-1*b-sqrt(d))/(a*2) ;
- return 1;
- } else if (a==0 && b!=0)
- {
- *x1=*x2=(-1*c)/b;
- return 1;
- } else if (a==0 && b==0 && c==0)
- {*x1=*x2=0; return 1;}
- else return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement