ProgIng - Programación en Ingeniería
Loading...
Searching...
No Matches
011_seno.c File Reference
#include <stdio.h>
Include dependency graph for 011_seno.c:

Go to the source code of this file.

Macros

#define PI2   2*3.1415926535897932

Functions

int main (int argc, char *argv[])

Macro Definition Documentation

◆ PI2

#define PI2   2*3.1415926535897932

Definition at line 3 of file 011_seno.c.

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 5 of file 011_seno.c.

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}
#define PI2
Definition 011_seno.c:3
double fct(double x, int n)
Definition Ejemplo029.c:34
Here is the call graph for this function: