Update 'cv3/program.c'
This commit is contained in:
parent
affd4a5ae5
commit
1369c121ed
@ -15,18 +15,9 @@ int main() {
|
|||||||
double coefficients[MAX_COEFFICIENTS];
|
double coefficients[MAX_COEFFICIENTS];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
printf("Enter the value of x: ");
|
scanf("%lf", &x);
|
||||||
if (scanf("%lf", &x) != 1) {
|
|
||||||
printf("Invalid input for x.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf("Enter coefficients from highest to lowest degree, finish with an empty line:\n");
|
|
||||||
while (scanf("%lf", &coef) == 1) {
|
while (scanf("%lf", &coef) == 1) {
|
||||||
if (count >= MAX_COEFFICIENTS) {
|
|
||||||
printf("Maximum number of coefficients exceeded.\n");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
coefficients[count++] = coef;
|
coefficients[count++] = coef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user