program main
  implicit none
  real(8) :: pi
  integer :: i
  character(16) :: str
  character(128) :: wfmt

  pi = acos(-1.d0)
  print*, '-------- real --------'
  print*, pi
  print"(f10.6)", pi
  print"(f0.6)", pi
  print"(e10.2)", pi
  print"(e10.3e3)", pi

  i = 2
  print*, '-------- integer --------'
  print*, i
  print"(i0)", i
  print"(i4)", i
  print"(i5.3)", i

  str = 'abcdef'
  print*, '-------- character --------'
  print"('character')"
  print*, str
  print"(a)", str
  print"(a3)", str

  print*, '-------- space and copy --------'
  print"(1x,a,2(1x,'i:',i0,' pi:',f8.3))", trim(str),i,pi,i*2,pi*2

  print*, '-------- use character variable --------'
  wfmt = "(a,1x,i0,1x,f12.8)"
  write(6,wfmt) trim(str),i,pi

  write(wfmt,"('(a,1x,i',i0,',1x,f12.8)')") 0
  write(6,wfmt) trim(str),i,pi
end program main