Untitled

 avatar
unknown
c_cpp
2 years ago
459 B
8
Indexable
#include <iostream>
#include <cmath>
using namespace std;

double f(double x) {
    return sin(pow(x, 2) - 5 * x) + 20 * log10(x);
}

double calculate(double a, double c) {
    double ac = a * c;
    return (f(a) * f(c) - f(ac)) / pow(f(a / c), 2);
}

int main() {
    double a = 5.6;
    double h_c = 0.5;
    for (double c = 2; c <= 7; c += h_c) {
        cout << "c = " << c << ", A = " << calculate(a, c) << endl;
    }
    return 0;
}
Editor is loading...