#include #include #include #include int main() { setlocale(LC_ALL, "Russian"); double x1; double x2; double dx; double a; double b; double c; printf("Enter a: "); scanf("%lf", &a); printf("Enter b: "); scanf("%lf", &b); printf("Enter c: "); scanf("%lf", &c); do { printf("Enter x1: "); scanf("%lf", &x1); printf("Enter x2: "); scanf("%lf", &x2); printf("Enter dx: "); scanf("%lf", &dx); } while ((x2 <= x1) && (dx >= fabs(x2 - x1))); int const lines = 3; int l; double x = x1, f; while (x <= x2) { printf("-----------------------------\n"); printf("| x | f |\n"); printf("-----------------------------\n"); for (l = 1; ((x <= x2) && (l <= lines)); l++, x += dx) { if ((x > 0) && (b == 0)) { if (((x - a) != 0) || ((x - c) != 0)) { f = ((x - a) / (x - c)); printf("| %11.3lf | %11.3lf |\n", x, f); } else { printf("| %11.3lf | error |\n", x); } } else if ((x < 0) && (b != 0)) { f = (x * x + b); printf("| %11.3lf | %11.3lf |\n", x, f); } else if (c != 0) { f = (x / c); printf("| %11.3lf | %11.3lf |\n", x, f); } else { printf("| %11.3lf | error |\n", x); } } printf("-----------------------------\n"); if (x <= x2) { printf("Press ENTER for continue: "); if (getchar() != '\n') break; } } }