- 675 名前:デフォルトの名無しさん mailto:sage [2008/06/16(月) 01:21:01 ]
- #include <stdio.h>
#include <math.h> int main(void) { double a, b, c, d; scanf("%lf%lf%lf", &a, &b, &c); d = b * b - 4 * a * c; if(d < 0) printf("実数解をもちません\n"); else if(d > 0) printf("%f, %f\n", (-b + sqrt(d))/ (2*a), (-b-sqrt(d)) / (2*a)); else printf("%lf\n", -b / (2 * a)); return 0; }
|

|