Question: MAKE FACTORIAL AS RECURSIVE FUNCTION IN THE FOLLOWING CODE (FORTRAN90), THANKS! program poisson_probability IMPLICIT NONE REAL AveOccurs, probability INTEGER:: NumProbs,I, NumOccurs print, this program calculates
MAKE FACTORIAL AS RECURSIVE FUNCTION IN THE FOLLOWING CODE (FORTRAN90), THANKS!

program poisson_probability IMPLICIT NONE REAL AveOccurs, probability INTEGER:: NumProbs,I, NumOccurs print," this program calculates poisson probabilites, " write (*, ' (x,A)', ADVANCE = "NO")& "HOW MANY PROBABILITIES do you wish to calculate?" READ, Numprobs Do I -1, numprobs write (*, "(1x,A)', advance= "NO")& "enter average # of occurrences per time period :" READ, Ave0ccurs "(1x,A), Advance="no")a (*, " enter # of occurrences for which to find probability :" Write READ, Numoccurs probability = poisson(aveoccurs,Num0ccurs) Print 10, Probability 10 format(1x, "poisson probability- f6.4/) contains function poisson (lambda,N) Real: poisson real, INTENT (IN) Lambda INTEGER, Intent (In)::N EXP(-lambda ))/real(factorial(N)) poisson (LAMBDA**N* End function poisson FUNCTION Factorial (n) INTEGER, intent(IN) N integer: factorial,I Factorial -1 Do!= 2, N factorial= factorial*! end function factorial END PROGRAM poisson_probability program poisson_probability IMPLICIT NONE REAL AveOccurs, probability INTEGER:: NumProbs,I, NumOccurs print," this program calculates poisson probabilites, " write (*, ' (x,A)', ADVANCE = "NO")& "HOW MANY PROBABILITIES do you wish to calculate?" READ, Numprobs Do I -1, numprobs write (*, "(1x,A)', advance= "NO")& "enter average # of occurrences per time period :" READ, Ave0ccurs "(1x,A), Advance="no")a (*, " enter # of occurrences for which to find probability :" Write READ, Numoccurs probability = poisson(aveoccurs,Num0ccurs) Print 10, Probability 10 format(1x, "poisson probability- f6.4/) contains function poisson (lambda,N) Real: poisson real, INTENT (IN) Lambda INTEGER, Intent (In)::N EXP(-lambda ))/real(factorial(N)) poisson (LAMBDA**N* End function poisson FUNCTION Factorial (n) INTEGER, intent(IN) N integer: factorial,I Factorial -1 Do!= 2, N factorial= factorial*! end function factorial END PROGRAM poisson_probability
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
