[[問題文>練習問題#p5d7bfb2]]
 #include <stdio.h>
 #include <math.h>
 
 int main(void) {
     double a, b, c, D;
     double x1, x2;
     a = 0.0000000045;
     b = 10;
     c = 1;
 void f(double a, double b, double c) {
     double D, x1, x2;
     D = b*b - 4*a*c;
     if(D >= 0) {
         x1 = (fabs(b) + sqrt(D)) / (2. * a);
         x1 = b < 0 ? x1 : -x1;
         if(D > 0) {
             x2 = c / (a * x1);
             printf("%lf, %lf\n", x1, x2);
         } else {
             printf("%lf\n", x1);
         }
     }
 }
 
 int main(void) {
     f(0.0000000045, 10, 1);
     return 0;
 }



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS