#include <stdio.h>
Go to the source code of this file.
|
| int | main (int argc, char *argv[]) |
◆ main()
| int main |
( |
int | argc, |
|
|
char * | argv[] ) |
Definition at line 3 of file Ejemplo008.c.
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));
19 }
20 lnx*=2;
21 printf("ln(%f) = %f\n", x, lnx);
22 return 0;
23}
double fct(double x, int n)