Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  lab3
Language: FORTRAN
Code:
     program hello
     integer n
     print *,"Hello World!"
     read *, n
     end program hello
        program Hello
parameter(n1=8,n2=6)
dimension u(0 : n1,0 : n2)
open(1,file='Iva3.dat')
print*,vvesti dl1,dl2,c'
read*,dl1,dl2,c
print*,'dl1',dl1, 'dl2,'dl2,' c=,'c
write(1,*)'dl1=,'dl1,' dl2=,'dl2,' c=',c
h1=dl1/n1
h2=dl2/n2
do 1 i=0,n1
x=h1*i
do 1 j=0,n2
y=h2*j
u(i,j)=0
if(i.eq.0.or.i.eq.n1) u(i,j)=4*4/dl2*y*(dl2-y)
if(j.eq.0.or.j.eq.n2) u(i,j)=4*23/dl1*x*(dl1-x)
k=1
z=0
do 3 i=1,n1-1
d0 3 j=1,n2-1
r=u(i,j)
u(i,j)=((u(i-1,j)+u(i+1,j))/h1**2+(u(i,j-1)+u(i,j+1))/h2**2-c)/(2/h1**2+2/h2**2)
z=z+abs(u(i,j)-r)
k=k+1
if(z.gt.0.001.and.k.lt.100) goto 2
print 4,k
write(1,4)k
format(2x,'число итераций k=',i3// 5x,'решение'//)
do 5 j=0,n2
write(1,6)(u(i,j),i=0,n1)
print 6,(u(i,j),i=0,n1)
format(11f7.2)
end          
Comments: