Hi there today i try to coding euler in C programming. Let’s talk about the euler number first, what is the euler number? İs a commonly used number in engineering. Capacitor voltage formula, example of this.

Let try calculate euler number.

#include<stdio.h>
int fact(int a){
	int b,c;
	if(a==1){
		return 1;
	}
	else{
		b=fact(a-1)*a;
		return b;
	}}	
double euler(int a){
	double b=0,c=0;
	if(a==1){
		return 2;
	}
	else{
		c=fact(a);
		b=1/c;
		c=b+euler(a-1);
		return c;
	}}
int main(){
	int a;
	double e;
	printf("how many step calculate for euler?\n");
	scanf("%d",&a);
	if(a!=1){
		e=euler(a-1);
	}
	else{
		e=1;
	}
	printf("\nResult the steps:%.20f",e);
}

Leave a Reply

Your email address will not be published. Required fields are marked *