| [Fortran] syntaxhighlighter_viewsource syntaxhighlighter_copycode program ex0831
implicit none
integer ::n
write(*,*)'N='
read (*,*)n
write(*,"(I2,'!=',I8)")n,fact(n)
stop
end
contains
recursive integer function fact(n)result(ans)
implicit none
integer ,intent(in)::n
if (n<0)then
ans=-1
return
else if (n<=1)then
ans =1
return
end if
ans=n*fact(n-1)
return
end function fact
end--------------------Configuration: 21351 - Win32 Debug--------------------
 Compiling Fortran...
 E:\Fortran\MSDEV98\MyProjects\21351\320020.f90
 E:\Fortran\MSDEV98\MyProjects\21351\320020.f90(6) : Error: This name does not have a type, and must have an explicit type.   [FACT]
 write(*,"(I2,'!=',I8)")n,fact(n)
 -------------------------^
 Error executing df.exe.
 
 21351.exe - 1 error(s), 0 warning(s)
 
 
 
 |