1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| program main
use sub_div
implicit none
integer :: ai, bi, resi
real :: af, bf, resf
double precision :: ad, bd, resd
complex :: ac, bc, resc
double precision, dimension(:), allocatable :: at, bt, rest
allocate (at(2),bt(2),rest(2))
ai=3
bi=2
af=3.0
bf=2.0
ad=3.d0
bd=2.d0
ac=(3.0,0.0)
bc=(0.0,2.0)
at(1)=acos(-1.d0)
bt(1)=2.d0
at(2)=3.d0
bt(2)=2.d0
call sub_div_a_b(ai,bi,resi)
print *, "integer: ",ai,"/",bi,"=",resi
call sub_div_a_b(af,bf,resf)
print *, "float : ",af,"/",bf,"=",resf
call sub_div_a_b(ad,bd,resd)
print *, "double : ",ad,"/",bd,"=",resd
call sub_div_a_b(ac,bc,resc)
print *, "complex: ",ac,"/",bc,"=",resc
call sub_div_a_b(at(:),bt(:),rest(:))
print *, "dptable: ",at(1),"/",bt(1),"=",rest(1)
print *, "dptable: ",at(2),"/",bt(2),"=",rest(2)
deallocate (at,bt,rest)
end program main |
Partager