program main
    read(*,*)n
    sum=0.0
    k=1
    100 sum=sum+(-1.0)**(k+1)/float(k)
    k=k+1
    if (k<n) go to 100
    WRITE(6,200) sum
    200 format(1x,'sum=',f10.2)
    stop
end program main

Embed on website

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