Fortran programe
c surface area and volume of box
open(unit=1,file='c:\msdev\box.dat')
open(unit=2,file='c:\msdev\result.dat')
read(1,*)a,b,c
sur=2.0*(a*b+a*c+b*c)
vol=a*b*c
write(2,10)a,b,c,sur,vol
10
format(5x,'dimension of box'/7x,3(f6.2,15x)//
+6x,'surface area =',f10.1//6x,'volume=',f16.2)
stop
end
c programe fr calculating the area and premeter f a triangle
open(unit=1,file='c:\msdev\tri.dat')
open(unit=2,file='c:\msdev\result of tri.dat')
read (1,*)a,b,c
pre=a+b+c
s=pre/2
area=sqrt(s*(s-a)*(s-b)*(s-c))
write(2,10)a,b,c,pre,area
10 format(15x,'trianle specificaion'//15x,3(f5.2,15x)//
+15x,'premeter of triangle=
',15x,f7.3,10x,'meter'/
+15x,'surface area of triangle= ',15x,f7.3,10x,'meter^2')
stop
end
c
c **** triangle area for more triangles ******
dimension a(20),b(20),c(20),s(20),p(20),area(20)
n=5
open(unit=1,file='c:\msdev\mretri.dat')
open(unit=2,file='c:\msdev\result.dat')
read(1,*)(a(20),b(20),c(20),i=1,n)
do 10 i=1,n
p(i)=a(i)+b(i)+c(i)
s(i)=p(i)/2.0
area(i)=sqrt(s(i)*(s(i)-a(i))*(s(i)-b(i))*(s(i)-c(i)))
write(*,*)i,a(i),b(i),c(i),p(i),s(i),area(i)
write(2,15)i,a(i),b(i),c(i),p(i),s(i),area(i)
15
FORMAT(1h1,/,
+'Temperature at the base of the fin =',F7.2,' deg.c',//,
+'Convective heat transfer coeff
+'Theramal conductivity
+'Thickness of the fin
+'Temp of the ambient air
+'Length of the fin
FORMAT(1h1,/,
+'Temperature at the lower plat =',F7.2,' deg.c',//,
+'Convective heat transfer coeff
+'Theramal conductivity
+'Thickness of the fin
+'Temp of the ambient air
KOUNT=0
C------ITERATED VALUE
C------------------300
TT(1,1)=TZERO
C --------EQUATION 5-2a
C----------------------DO 204 I=2,MM
DO 204 J=2,NN
204
TT(I,J)=(T(I-1,J)+T(I+1,J)+T(I,J-1))/4
C
C --------EQUATION 5-5a
C---------------------C---------FOR INSULATED NODE
C---------LEFT NODES
DO 2000 I=1
DO 2000 J=2,NN
2000 TT(I,J)=(T(I,J+1)+T(I,J-1)+(2*T(I+1,J)))/4
C---------RIGHT NODES
DO 3000 I=M
DO 3000 J=2,NN
3000 TT(I,J)=(T(I,J+1)+T(I,J-1)+(2*T(I-1,J)))/4
C---------BOTTOM NODES
DO 4000
I=2,3
DO 4000
J=1
4000 TT(I,J)=(T(I+1,J)+T(I-1,J)+(2*T(I,J+1)))/4
DO 5000 I=4,7
DO 5000 J=1
5000 TT(I,J)=TZERO
DO 6000 I=8,9
DO 6000 J=1
6000 TT(I,J)=(T(I+1,J)+T(I-1,J)+(2*T(I,J+1)))/4
C---------FOR CONVECTION NODES
C---------UPPER NODES
DO 7000 I=2,MM
DO 7000 J=N
7000 TT(I,J)=(T(I,J-1)+((T(I+1,J)+T(I-1,J))/2)+(B1*TAIR))/(2+B1)
C---------FOR INSULATED CORNER NODE
C---------BOTTOM RIGHT NODES
TT(1,M)=(T(I,J+1)+T(I-1,J))/2
C---------BOTTOM LEFT NODES
TT(1,1)=(T(I,J+1)+T(I+1,J))/2
C---------FOR JNSULATED & CONVECTION CORNER NODE
C---------RIGHT UPPER NODE
TT(M,N)=(T(I-1,J)+T(I,J-1)+(B1*TAIR))/(2+B1)
C---------LEFT UPPER NODE