1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 02:25:37 +00:00
202401-programming-assignments/【额外练习】选择结构/7-35 选择-简单的运算Ⅱ.c

28 lines
467 B
C

#include <stdio.h>
int main() {
double a, b, c;
scanf("%lf%lf%lf", &a, &b, &c);
if (a == 0) {
if (b == 0 && c != 0) {
printf("0\n");
} else {
printf("1\n");
}
} else {
double delta = b * b - 4 * a * c;
if (delta > 0) {
printf("2\n");
} else if (delta == 0) {
printf("1\n");
} else {
printf("0\n");
}
}
return 0;
}