ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
Ejemplo008.c
Go to the documentation of this file.
1#include<stdio.h>
2
3int main(int argc, char*argv[])
4{
5 int i, n;
6 float x, lnx, fct, num;
7 do{
8 printf("Ingrese el numero de terminos: ");
9 scanf("%d", &n);
10 }while(n<1);
11 do{
12 printf("Ingrese l valor de x: ");
13 scanf("%f", &x);
14 }while(x<=0);
15 for(i=0, fct=(x-1)/(x+1), num=fct, lnx=0; i<n; i++)
16 {
17 lnx+=(num/(2*i+1));
18 num*=(fct*fct);
19 }
20 lnx*=2;
21 printf("ln(%f) = %f\n", x, lnx);
22 return 0;
23}
double fct(double x, int n)
Definition Ejemplo029.c:34
int main(void)
Definition Ejemplo_035.c:15