program enter ! This file: http://ftp.aset.psu.edu/pub/ger/fortran/hdk/enter.f90 ! ! Illustrates how to enter a number or assume a default value if only ! the Enter key is pressed. implicit none character(80) line real :: value = 100.0 line='' ! f0.d is a Fortran 95 feature that means that the output field width ! will be as only as wide as as necessary to accomodaet the value. write(*,'(a,f0.0,a)',advance='no') & ' Enter a number (or just press Enter for value=',value,'):' read(*,'(a)') line if(line /= "") read(line,*) value write(*,*) 'The number input:',value end program enter