Example of read statement from user’s input

 

program read_statement
implicit none
real momentum, mass, velocity

!————————————————————————
! request for input values from user
!————————————————————————
print*, “Provide a value for mass (in units of kilogram)”
read*, mass

print*
print*, “What is the velocity of the object (in meter per second)?”
read*, velocity

!————————————————————————
! calculate linear momentum
!————————————————————————
momentum = mass * velocity

print*,
print 101, “The momentum of the object is”, momentum, “kg m/s”
101 format(a,1x,f6.3,1x,a)
print*

end program