Загрузка данных


#include <stdio.h>
#include <math.h>

int main() {
    float A = 1.5;
    int N;
    float dx = A / 5;
    double y, x = -2 * A;

    printf("Введите количество значений N: ");
    scanf("%d", &N);

    printf("\n==== Табулирование функции ====\n");
    printf("+------------+--------------+\n|     x      |      y       |\n");
    printf("+------------+--------------+\n");

    for (int i = 0; i <= N; i++) {
        if (x < 0) {
            // y = cbrt( 3A * (1 - sqrt(-x^3)) )
            y = cbrt(3 * A * (1 - sqrt(-x * x * x)));
        }
        else {
            // y = sqrt( sqrt(16A^4 + 4A^2*x^2) - x^2 - A^2 )
            y = sqrt(sqrt(16 * A * A * A * A + 4 * A * A * x * x) - x * x - A * A);
        }

        if (isnan(y) == 1)
            printf("|%f  | Undefined|\n", x);
        else
            printf("|%f  | %12f|\n", x, y);

        x = x + dx;
    }

    printf("+------------+--------------+\n");
    getchar();
    return 0;
}