C Program to find the factorial of a non-negative integer
write(*,*)'Enter a non-negative integer:'
read(*,*)n
write(*,*)'The factorial of',n,'is',fact(n)
end
C Program sub function
function fact(n)
fact=1
do i=1,n
fact=fact*i
end do
return
end
write(*,*)'Enter a non-negative integer:'
read(*,*)n
write(*,*)'The factorial of',n,'is',fact(n)
end
C Program sub function
function fact(n)
fact=1
do i=1,n
fact=fact*i
end do
return
end
Comments
Post a Comment