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