Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
435 B
1
Indexable
#include <stdio.h>
#include <math.h>
#define pi 3.14
int f(int);
int f_xh(int,int);
int main(){
	int x,d,dx;
	int h;
	 print("Enter the value of x:");
	 scanf("%d",&x);
	 print("Enter the interval gap:");
	 scanf("%d",&h);
	 d=f(x);
	 dx=f_xh(x,h);
	 int result;
	 result=(dx-d)/h;
	 print("The derivative of f(x) is %d",result);
}
int f(int x){
	return sin(x)+1;
}
int f_xh(int x,int h){
	return (sin(x+h)+1);
}