! Program to find the sum of AP series
real::a,d
integer::n
write(*,*)'Enter the number of terms, 1st term and common difference:'
read(*,*)n,a,d
sum=0
do i=0,n-1
term=a+i*d
sum=sum+term
end do
write(*,*)'The sum of the AP series is',sum
end
real::a,d
integer::n
write(*,*)'Enter the number of terms, 1st term and common difference:'
read(*,*)n,a,d
sum=0
do i=0,n-1
term=a+i*d
sum=sum+term
end do
write(*,*)'The sum of the AP series is',sum
end
Comments
Post a Comment