program test
real::x,t,s
integer::i,n
print*,"Enter the angle in degree:"
read(*,*)x
print*,"Enter the # of countable terms:"
read(*,*)n
!converting the angle from degree to radian
x=x*3.14159/180
t=x
s=x
do i=1,n
t=-t*x*x/(2*i*(2*i+1))
s=s+t
enddo
print*,s
end
real::x,t,s
integer::i,n
print*,"Enter the angle in degree:"
read(*,*)x
print*,"Enter the # of countable terms:"
read(*,*)n
!converting the angle from degree to radian
x=x*3.14159/180
t=x
s=x
do i=1,n
t=-t*x*x/(2*i*(2*i+1))
s=s+t
enddo
print*,s
end
Comments
Post a Comment