C Program to find the 1st nth terms and their sum of fibonacci series
write(*,*)'Enter the number of terms you want to see'
read(*,*)n
i=1
j=1
sum=0
write(*,*)'The 1st',n,'terms are:'
do l=1,n
write(*,*)i
sum=sum+i
k=i+j
i=j
j=k
end do
write(*,*)'The sum of the series is:',sum
end
write(*,*)'Enter the number of terms you want to see'
read(*,*)n
i=1
j=1
sum=0
write(*,*)'The 1st',n,'terms are:'
do l=1,n
write(*,*)i
sum=sum+i
k=i+j
i=j
j=k
end do
write(*,*)'The sum of the series is:',sum
end
Comments
Post a Comment