recursive function fac(n) result (fac1)
if (n==1) then
fac1=1
else
fac1=n*fac(n-1)
end if
end function
program fac_pro
implicit none
integer n
real fac
write(*,*) 'input'
read(*,*) n
write(*,*) n,'!=',fac(n)
end program
01.PNG (969 Bytes, 下载次数: 228)
read(*,*) n
QQ截图20200731164759.jpg (10.42 KB, 下载次数: 249)
欢迎光临 Fortran Coder (http://bbs.fcode.cn/) | Powered by Discuz! X3.2 |