Basics
Variables
Integer and Real
Modern Fortran has explicit numeric types. Integer math is exact; real math approximates with floating point.
Program
Play the program to convert an integer to real and halve it.
variables.f90
program variables
implicit none
integer :: count
real :: half
count = 5
half = real(count) / 2.0
print '(I0, A, F0.1)', count, " ", half
end program variables
type declaration
`integer ::` and `real ::` give a variable its type.
type conversion
`real(count)` converts an integer to a real.
format spec
`F0.1` prints a real with one decimal and minimum width.