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

28 lines
467 B
C
Raw Normal View History

2024-10-31 08:45:40 +00:00
#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;
}