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
To embed this project on your website, copy the following code and paste it into your website's HTML: