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