In Fortran factorial has no any specific functional notation. In this case we have to calculate factorial as follows
1234567890
Integer Fact
Write(*,*) 'Enter the value of N'
read(*,*) N
Fact = 1
Do i = 1,N
Fact = Fact*i
End do
write(*,*) 'The factorial of N is = ',Fact
End
Example :
Find 10! (10 factorial)
1234567890
Integer Fact
Fact = 1
Do i = 1,10
Fact = Fact*i
End do
write(*,*) 'The value of 10 factorial is = ',Fact
End
No comments:
Post a Comment