ARRAYS

 !Program name: ARRAYS

real :: A(4), B(4,4)

integer :: i

 

A=[1.,-0.5,5.,3.3]

B(1,:)=A        ! set the first row be elements of A

B(2,:)=[(B(1,i)**2,i=1,4)]  !set the 2nd row be the square of the first row

B(3,:)=0.  ! set the third row be zero

B(4,:)=sqrt(abs(A))  ! set the forth row be the square root of A

Print *, A

Print *,

do i=1,4

   print *, B(i,1), B(i,2), B(i,3), B(i,4)

end do

stop

end

Comentários

Postagens mais visitadas deste blog

RECURSIVE

HYDROGEN-RADIAL

RUNGE-KUTTA