Monday, May 6, 2013

Sum of serise: The natural logarithm can be approximated by the following series.

#include<stdio.h>
void main()
{
float x,a,b=1,sum=0;
printf("Enter the value of X: ");
scanf("%f"&x);
a=(x-1)/x;
for(int k=1;k<=7;k++)
{
b=b*a;
sum+=b;
}
sum-=a;
sum/=2;
sum+=a;
printf("\n\n\t The Natural algorithm of %f=%f",x,sum);
return 0;
}

No comments:

Post a Comment