#include <stdio.h> #include <math.h> int main() { float a, b, c; float x1, x2, delta; scanf("%f %f %f", &a, &b, &c); delta = b*b - 4.0*a*c; if ( delta > 0 ) { x1 = (-b + sqrt(delta))/(2*a); x2 = (-b - sqrt(delta))/(2*a); if ( x1 >= x2 ) { printf("%.2f %.2f", x1, x2); } else { printf("%.2f %.2f", x2, x1); } } else { printf("无实数根!") } return 0; } /* Main.c: In function 'main': Main.c:26:2: error: expected ';' before '}' token } ^ */ |
Double click to view unformatted code.