double f(double x) { return 2 * x; } double sum(double (*f)(double d), int n, int m) { double result = 0; for (int i = n; i <=m; i++) { result += f(i); } return result; } int main() { sum(f, 1, 10); }
double f(double x) { return 2 * x; } double sum(double (*f)(double d), int n, int m) { double result = 0; for (int i = n; i <=m; i++) { result += f(i); } return result; } int main() { sum(f, 1, 10); }