program assign4_1
use printmat2
implicit none
integer :: n=2
real,allocatable :: a(:,:)
integer,allocatable :: b(:,:)
character (128) :: fmt

allocate(a(n,n),b(n,n))
a=reshape((/1.1234,2.1234,3.1234,5.1234/),(/n,n/))
b=reshape((/1,2,3,5/),(/n,n/))

print*,'Fixed format (g12.5)'

call printnice(a)

print*,'Format for real'
read(*,'(a128)') fmt

call printnice(a,form=fmt)

print*,'Fixed format (i8)'

call printnice(b)

print*,'Format for integer'
read(*,'(a128)') fmt

call printnice(b,form=fmt)

end program assign4_1