이번에 포트란77을 배우고 있는데 어째 제가 생각한 것과 출력이 다른데<br>제가 뭘 잘못생각하고 있는 건지 알려주세요.(공부에 도움이 되는 정도만요 답을 알려주지 마시구요.)<br><br>제가 하려는건 두행렬을 곱한 행렬을 구하는건데요.<br>중간에 if 조건으로 A의 행 크기와 B의 열 크기 같지 않으면 못 곱해가 출력되고 같으면 곱셈으로 진행되는건데<br>왜 때문인지 두 행렬의 크기를 2x2로 집어 넣었는데 못곱한다고 끝납니다.<br><br><br> program arr1<br> <br> integer ia, ja, ib, jb, n, m<br> real a(10, 10), b(10,10), C(10,10) ,adat, bdat<br> n=0<br> m=0<br> open(100,file='output.dat')<br> <br> write(*,*) 'Array i and j maximum is 10'<br> write(*,*) 'Array A is i size, ia ='<br> read (*,*) ia<br> write(*,*) 'Array A is j size, ja ='<br> read (*,*) ia<br><br> write(*,*) 'Array B is i size, ib ='<br> read (*,*) ib<br> write(*,*) 'Array B is j size, jb ='<br> read (*,*) ib<br> <br> if(ia.EQ.jb) then<br><br> do 10 n = 1,ja,1<br> do 20 m = i,ia,1<br> write(*,*) 'Array A(i,j) adat' <br> read(*,*) adat<br> a(n,m) = adat<br> 20 continue<br> 10 continue<br> <br> n=0<br> m=0<br> <br> do 30 n = 1,jb,1<br> do 40 m = i,ib,1<br> write(*,*) 'Array B(i,j) bdat'<br> read(*,*) bdat<br> a(n,m) = bdat<br> 40 continue<br> 30 continue <br> <br> n=0<br> m=0 <br> n1=0<br> m2=0<br> <br> do 50 n = 1,ja,1<br> do 60 m = 1,ia,1<br> do 70 m1 = 1,ib,1<br> do 80 n1 = 1,jb,1<br> c(n,m)=a(n,m)*b(n1,m1)<br> 80 continue<br> 70 continue<br> 60 continue<br> 50 continue<br> <br> write(100,*) 'Array C is =', c<br><br><br> else<br> write(*,*) 'Array A and B is not multiply'<br> endif<br> <br> stop<br> end<br>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.