Untitled
unknown
plain_text
2 years ago
362 B
7
Indexable
#include <stdio.h>
#define h 0.1 // Step size
double f(double x) {
return 5 * pow(x, 3) + 1;
}
int main() {
double x;
printf("Enter the x-value: ");
scanf("%lf", &x);
double f_prime = (f(x + h) - f(x)) / h;
printf("The derivative of f(x) at x = %f using forward difference formula is: %f\n", x, f_prime);
return 0;
}Editor is loading...
Leave a Comment