Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  sin
Language: FORTRAN
Code:
PROGRAM taylorsen
IMPLICIT NONE

DOUBLE PRECISION::r, c, x, pi=3.14159
INTEGER:: n

WRITE(*,*)'ingrese un numero x  en grados'
READ(*,*) x

r=x*pi/180.

     DO n=0, 50, 1
          
          c=c+((-1)**n)*(r**(2*n))/(fact(2*n))

     END DO
          
WRITE(*,*) 'El resultado aproximado es=', c
WRITE(*,*) 'El resultado real es=', sin(r)

CONTAINS

FUNCTION fact(n)
IMPLICIT NONE 
DOUBLE PRECISION:: fact
INTEGER:: i, n

fact = 1
DO i = 1, n, 1
    fact= fact*i
END DO

END FUNCTION fact

END PROGRAM
          
Comments: