5 solutions
-
1
#include <stdio.h> #include <math.h> int main() { double a,b,c; scanf("%lf %lf %lf",&a,&b,&c); double t=b*b-4*a*c; double x1=(-b+sqrt(t))/(2*a); double x2=(-b-sqrt(t))/(2*a); while(t>=0){ if(t==0) printf("x1=x2=%.5f",x1); else//t>0 { if(x1<x2) printf("x1=%.5f;x2=%.5f",x1,x2); else//x2<x1 printf("x1=%.5f;x2=%.5f",x2,x1); } return 0; } printf("No answer!"); return 0; }
Information
- ID
- 6735
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- 9
- Tags
- (None)
- # Submissions
- 712
- Accepted
- 72
- Uploaded By