Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
362 B
1
Indexable
Never
#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;
}
Leave a Comment