Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Question!


Name: nitesh
Title:
  find erro
Question:
what is error in this code
program pivalue
integer :: i,n
real :: p,sum1=0,sum2=0,sum
real :: j=1.0
write(*,*) 'How many terms do you want to give for series?'
read(*,*) n
do i=1,n
!do j=0,n-1
if (mod(i,2)==0) then
sum1=sum1-1.0/j
else 
sum2=sum2 1.0/j
end if
sum=sum1 sum2
j=j 2.0
!end do
end do
p=4.0*sum
write(*,*)'The value op pi is : ',p
end program pivalue
Answers: