program sum_given_series
implicit none 
integer :: i,n,f
real ::t,s,x
print*,"enter x and n respectivly " 
read*,x,n 
f=1
s=0
do i=1,n 
 if(mod(i,2).EQ.0)then 
 f=f*i
 t=-x**i/f
 print*,t
 s=s+t 
 else
 f=f*i
 t=x**i/f 
 print*,t
 s=s+t
 endif
end do
print*,"the sum of the series is ",s
end program 

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: