Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdio.h"
- #include "math.h"
- int main()
- {
- int a, b, c, D;
- scanf("%d%d%d", &a, &b, &c);
- if(a==0)
- {
- if(b==0)
- {
- if (c==0)
- printf("x - all");
- else
- printf("no solution");
- }
- else
- {
- if(c==0)
- printf("x=0");
- else
- printf("%f", -(float)c/b);
- }
- }
- else
- {
- if(b==0)
- {
- if(c==0)
- printf("x=0");
- else
- {
- if(-(double)c/a>0)
- printf("%f", sqrt(-(double)c/a));
- else
- printf("no solution66");
- }
- }
- else
- {
- D=b*b-4*a*c;
- if(D<0)
- printf("no solution");
- else
- {
- if(D=0)
- printf("%f", -(float)b/2/a);
- else
- printf("x1=%f, x2=%f", (float)(-b-sqrt(D))/2/a, (float)(-b+sqrt(D)/2/a));
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment