- 440 名前:デフォルトの名無しさん mailto:sage [2007/10/28(日) 21:34:38 ]
- >>432
#include <stdio.h> #include <math.h> int solve(double a, double b, double c); double answer1; double answer2; int solve(double a,double b, double c) { double check; check = b * b - 4 * a * c; if(check > 0){ answer1 = (b + sqrt(b * b - 4 * a * c)) / (2 * a); answer2 = (b - sqrt(b * b - 4 * a * c)) / (2 * a); return 2; }else if(check == 1){ answer1 = (b + sqrt(b * b - 4 * a * c)) / (2 * a); answer2 = answer1; return 1; } return 0; } main()は省略 汚いコードだけどこんな感じ
|

|