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