EXPONENTIAL

 !Program name: EXPONENTIAL

!Exponential of x

Integer::i,j,n,fact

real::x,sum

Print *, 'Let us calculate Exp(x)'

Print *, 'Input a number for x: '

read *, x

Print *, 'Input a truncation number (n) for the series: '

read *, n

sum=1

outer: do i=1,n

      fact=1

      inner: do j=1,i

           fact=fact*j

      End do inner

      sum=sum+(x**i)/REAL(fact)

End do outer

Print *, 'Exp(x)= ', sum

stop

end

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA