program factorial
integer::i,n,fac
write(*,*)"Enter the number"
read(*,*)n
fac=1
if(n<0)then
write(*,*) "Factorial is not defined"
else
do i=1,n 
fac=fac*i 
end do
write(*,*)"Factorial of",n, "=",fac 
end if
end program factorial

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: