This commit is contained in:
2025-06-26 15:18:33 +09:00
parent e027e09906
commit 451aaee7ce
33 changed files with 366 additions and 106 deletions

10
programs/a3/info.json Normal file
View File

@@ -0,0 +1,10 @@
{
"language": "C",
"name": "課題3",
"description": "二次方程式の解の種類を判別するプログラム。",
"output": {
"type": "screenshot",
"content": "./assets/a3.png"
},
"note": "上記のコードリストは浮動少数点数の演算・変数格納時の誤差を考慮していない。\\n考慮する場合は\\\\texttt{float.h}内の\\\\texttt{DBL_MIN}や\\\\texttt{DBL_EPSILON}を用いた判別処理が必要である。"
}

BIN
programs/a3/main Executable file

Binary file not shown.

24
programs/a3/main.c Normal file
View File

@@ -0,0 +1,24 @@
#include <stdio.h>
int main(void) {
double a, b, c, D;
printf("a: ");
scanf("%lf", &a);
printf("b: ");
scanf("%lf", &b);
printf("c: ");
scanf("%lf", &c);
D = b * b - 4 * a * c;
if (D == 0.0) {
puts("Superposition");
} else if (D < 0.0) {
puts("Two complex answers");
} else if (D > 0.0) {
puts("Two real answers");
}
return 0;
}